Look-up table read

ABSTRACT

A digital data processor includes an instruction memory storing instructions specifying data processing operations and a data operand field, an instruction decoder coupled to the instruction memory for recalling instructions from the instruction memory and determining the operation and the data operand, and an operational unit coupled to a data register file and an instruction decoder to perform an operation upon an operand corresponding to an instruction decoded by the instruction decoder and storing results of the operation. The operational unit is configured to perform a table recall in response to a look up table read instruction by recalling data elements from a specified location and adjacent location to the specified location, in a specified number of at least one table and storing the recalled data elements in successive slots in a destination register. Recalled data elements include at least one interpolated data element in the adjacent location.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/570,640, filed Sep. 13, 2019, which claims priority to U.S. PatentApplication No. 62/853,120, filed May 27, 2019, each of which isincorporated by reference herein.

U.S. patent application Ser. No. 16/570,640 relates to the followingcommonly assigned applications: U.S. patent application Ser. No.16/570,519, filed Sep. 13, 2019, now U.S. Pat. No. 11,269,636; U.S.patent application Ser. No. 16/570,778, filed Sep. 13, 2019, now U.S.Pat. No. 11,226,822; U.S. patent application Ser. No. 16/570,874, filedSep. 13, 2019, now U.S. Pat. No. 11,436,015; and U.S. patent applicationSer. No. 16/570,931, filed Sep. 13, 2019, now U.S. Pat. No. 11,157,278,each of which is incorporated by reference herein.

BACKGROUND

Modern digital signal processors (DSP) face multiple challenges.Workloads continue to increase, requiring increasing bandwidth. Systemson a chip (SOC) continue to grow in size and complexity. Memory systemlatency severely impacts certain classes of algorithms. As transistorsget smaller, memories and registers become less reliable. As softwarestacks get larger, the number of potential interactions and errorsbecomes larger. Even wires become an increasing challenge. Wide bussesare difficult to route. Wire speeds continue to lag transistor speeds.Routing congestion is a continual challenge.

One technique useful for filtering functions is table look up. A datatable is loaded into memory storing a set of results at a memorylocation corresponding to an input parameter. To perform a function, theinput parameter is used to recall the pre-calculated result. Thistechnique can be particularly valuable for seldom used and difficult tocalculate mathematical functions.

SUMMARY

In accordance with at least one example of the disclosure, a digitaldata processor includes an instruction memory storing instructionsspecifying data processing operations and a data operand field, aninstruction decoder coupled to the instruction memory for recallinginstructions from the instruction memory and determining the operationand the data operand, and an operational unit coupled to a data registerfile and an instruction decoder to perform an operation upon an operandcorresponding to an instruction decoded by the instruction decoder andstoring results of the operation. The operational unit is configured toperform a table recall in response to a look up table read instructionby recalling data elements from a specified location and adjacentlocation to the specified location, in a specified number of at leastone table and storing the recalled data elements in successive slots ina destination register. Recalled data elements include at least oneinterpolated data element in the adjacent location.

In accordance with another example of the disclosure, a method includesperforming, by an operational unit coupled to a data register file andto an instruction decoder, a table recall in response to a look up tableread instruction by recalling data elements from a specified locationand at least one adjacent location to the specified location, in aspecified number of at least one table, the recalled data elementsincluding at least one interpolated data element in the adjacentlocation. The method also includes storing the recalled data elements insuccessive slots in a destination register.

BRIEF DESCRIPTION OF THE DRAWINGS

For a detailed description of various examples, reference will now bemade to the accompanying drawings in which:

FIG. 1 illustrates a dual scalar/vector datapath processor according toone embodiment;

FIG. 2 illustrates the registers and functional units in the dualscalar/vector datapath processor illustrated in FIG. 1 ;

FIG. 3 illustrates a global scalar register file;

FIG. 4 illustrates a local scalar register file shared by arithmeticfunctional units;

FIG. 5 illustrates a local scalar register file shared by multiplyfunctional units;

FIG. 6 illustrates a local scalar register file shared by load/storeunits;

FIG. 7 illustrates a global vector register file;

FIG. 8 illustrates a predicate register file;

FIG. 9 illustrates a local vector register file shared by arithmeticfunctional units;

FIG. 10 illustrates a local vector register file shared by multiply andcorrelation functional units;

FIG. 11 illustrates pipeline phases of a central processing unitaccording to an example embodiment;

FIG. 12 illustrates sixteen instructions of a single fetch packet;

FIG. 13 illustrates an instruction coding example in accordance with oneembodiment;

FIG. 14 illustrates the bit coding of a condition code extension slot 0;

FIG. 15 illustrates the bit coding of a condition code extension slot 1;

FIG. 16 illustrates the bit coding of a constant extension slot 0;

FIG. 17 is a partial block diagram illustrating constant extension;

FIG. 18 illustrates a carry control for SIMD operations according anexample embodiment;

FIG. 19 illustrates the data fields of an example look up tableconfiguration register;

FIG. 20 illustrates the data fields in an example look up table enableregister which specifies the type of operations permitted for aparticular table set;

FIG. 21 illustrates look up table organization for one table for thattable set;

FIG. 22 illustrates look up table organization for two tables for thattable set;

FIG. 23 illustrates look up table organization for four tables for thattable set;

FIG. 24 illustrates look up table organization for eight tables for thattable set;

FIG. 25 illustrates look up table organization for sixteen tables forthat table set;

FIG. 26 illustrates an example of the operation of the look up tableread instruction for four parallel tables, a data element size of byteand no promotion in accordance with an example embodiment;

FIG. 27 illustrates an example of the operation of the look up tableread instruction for four parallel tables, a data element size of byteand 2× promotion in accordance with an example embodiment;

FIG. 28 illustrates an example of the operation of the look up tableread instruction for four parallel tables, a data element size of byteand 4× promotion in accordance with an example embodiment;

FIGS. 29A and 29B together illustrate an example embodiment ofimplementation of the promotion;

FIG. 30 illustrates an example of an extension element illustrated inFIG. 29A;

FIG. 31 illustrates a multiplex control encoder controlling multiplexersillustrated in FIGS. 29A and 29B;

FIG. 32 illustrates an example of the operation of the look up tableread instruction for four parallel tables, a data element size of word,and 2-element interpolation in accordance with an example embodiment;

FIG. 33 illustrates an example of the operation of the look up tableread instruction for four parallel tables, a data element size of word,and 4-element interpolation in accordance with an example embodiment;

FIG. 34 illustrates an example of the operation of a multi-stagebutterfly unit to reorder data from a look up table prior to writing thereordered data to a destination register in response to execution of alook up table read instruction in accordance with an example embodiment;

FIG. 35 illustrates an example of the operation of a look up table writeinstruction for four parallel tables with a data element size of word inaccordance with an example embodiment;

FIGS. 36A and 36B illustrate examples of the operation of a look uptable initialization instruction in accordance with example embodiments;

FIG. 37 illustrates an example of the operation of a histograminstruction for four parallel histograms in accordance with an exampleembodiment; and

FIG. 38 illustrates an example of the operation of a weighted histograminstruction for four parallel histograms in accordance with an exampleembodiment.

DETAILED DESCRIPTION

FIG. 1 illustrates a dual scalar/vector datapath processor 100 accordingto an example embodiment of this disclosure. Processor 100 includesseparate level one instruction cache (L1I) 121 and level one data cache(L1 D) 123. Processor 100 includes a level two combined instruction/datacache (L2) 130 that holds both instructions and data. FIG. 1 illustratesthe connection between level one instruction cache 121 and level twocombined instruction/data cache 130 (bus 142). FIG. 1 illustrates theconnection between level one data cache 123 and level two combinedinstruction/data cache 130 (bus 145). The level two combinedinstruction/data cache 130 stores both instructions to back up level oneinstruction cache 121 and data to back up level one data cache 123. Thelevel two combined instruction/data cache 130 is further connected tohigher level cache and/or main memory in a manner known in the art andnot illustrated in FIG. 1 . In one embodiment, central processing unitcore 110, level one instruction cache 121, level one data cache 123 andlevel two combined instruction/data cache 130 are formed on a singleintegrated circuit. This single integrated circuit optionally includesother circuits.

Central processing unit core 110 fetches instructions from level oneinstruction cache 121 as controlled by instruction fetch unit 111.Instruction fetch unit 111 determines the next instructions to beexecuted and recalls a fetch packet sized set of such instructions. Thenature and size of fetch packets are further detailed below. As known inthe art, instructions are directly fetched from level one instructioncache 121 upon a cache hit (if these instructions are stored in levelone instruction cache 121). Upon a cache miss (the specified instructionfetch packet is not stored in level one instruction cache 121), theseinstructions are sought in level two combined cache 130. In oneembodiment, the size of a cache line in level one instruction cache 121equals the size of a fetch packet. The memory locations of theseinstructions are either a hit in level two combined cache 130 or a miss.A hit is serviced from level two combined cache 130. A miss is servicedfrom a higher level of cache (not illustrated) or from main memory (notillustrated). As is known in the art, the requested instruction may besimultaneously supplied to both level one instruction cache 121 andcentral processing unit core 110 to speed use.

Central processing unit core 110 includes plural functional units (alsoreferred to as “execution units”) to perform instruction specified dataprocessing tasks. Instruction dispatch unit 112 determines the targetfunctional unit of each fetched instruction. In one embodiment, centralprocessing unit 110 operates as a very long instruction word (VLIW)processor capable of operating on plural instructions in correspondingfunctional units simultaneously. A compiler may organize instructions inexecute packets that are executed together. Instruction dispatch unit112 directs each instruction to its target functional unit. In oneembodiment, the functional unit assigned to an instruction is completelyspecified by the instruction produced by a compiler in that the hardwareof central processing unit core 110 has no part in this functional unitassignment. Instruction dispatch unit 112 may operate on pluralinstructions in parallel. The number of such parallel instructions isset by the size of the execute packet. This will be further detailedbelow.

One part of the dispatch task of instruction dispatch unit 112 isdetermining whether the instruction is to execute on a functional unitin scalar datapath side A 115 or vector datapath side B 116. Aninstruction bit within each instruction called the s bit determineswhich datapath the instruction controls. This will be further detailedbelow.

Instruction decode unit 113 decodes each instruction in a currentexecute packet. Decoding includes identification of the functional unitperforming the instruction, identification of registers used to supplydata for the corresponding data processing operation from among possibleregister files, and identification of the register destination of theresults of the corresponding data processing operation. As furtherexplained below, instructions may include a constant field in place ofone register number operand field. The result of this decoding issignals for control of the target functional unit to perform the dataprocessing operation specified by the corresponding instruction on thespecified data.

Central processing unit core 110 includes control registers 114. Controlregisters 114 store information for control of the functional units inscalar datapath side A 115 and vector datapath side B 116. Thisinformation could include mode information or the like.

The decoded instructions from instruction decode unit 113 andinformation stored in control registers 114 are supplied to scalardatapath side A 115 and vector datapath side B 116. As a result,functional units within scalar datapath side A 115 and vector datapathside B 116 perform instruction specified data processing operations uponinstruction specified data and store the results in an instructionspecified data register or registers. Each of scalar datapath side A 115and vector datapath side B 116 includes plural functional units that mayoperate in parallel. These will be further detailed below in conjunctionwith FIG. 2 . There is a datapath 117 between scalar datapath side A 115and vector datapath side B 116 permitting data exchange.

Central processing unit core 110 includes further non-instruction basedmodules. Emulation unit 118 permits determination of the machine stateof central processing unit core 110 in response to instructions. Thiscapability will typically be employed for algorithmic development.Interrupts/exceptions unit 119 enables central processing unit core 110to be responsive to external, asynchronous events (interrupts) and torespond to attempts to perform improper operations (exceptions).

Central processing unit core 110 includes streaming engine 125.Streaming engine 125 supplies two data streams from predeterminedaddresses typically cached in level two combined cache 130 to registerfiles of vector datapath side B. This provides controlled data movementfrom memory (as cached in level two combined cache 130) directly tofunctional unit operand inputs. This is further detailed below.

FIG. 1 illustrates data widths of busses between various parts for anexample embodiment. Level one instruction cache 121 suppliesinstructions to the instruction fetch unit 111 via bus 141. Bus 141 is a512-bit bus in this example embodiment. Bus 141 is unidirectional fromlevel one instruction cache 121 to central processing unit 110. Leveltwo combined cache 130 supplies instructions to level one instructioncache 121 via bus 142. Bus 142 is a 512-bit bus in this exampleembodiment. Bus 142 is unidirectional from level two combined cache 130to level one instruction cache 121.

Level one data cache 123 exchanges data with register files in scalardatapath side A 115 via bus 143. Bus 143 is a 64-bit bus in this exampleembodiment. Level one data cache 123 exchanges data with register filesin vector datapath side B 116 via bus 144. Bus 144 is a 512-bit bus inthis example embodiment. Busses 143 and 144 are illustrated asbidirectional supporting both central processing unit 110 data reads anddata writes. Level one data cache 123 exchanges data with level twocombined cache 130 via bus 145. Bus 145 is a 512-bit bus in this exampleembodiment. Bus 145 is illustrated as bidirectional supporting cacheservice for both central processing unit 110 data reads and data writes.

As known in the art, CPU data requests are directly fetched from levelone data cache 123 upon a cache hit (if the requested data is stored inlevel one data cache 123). Upon a cache miss (the specified data is notstored in level one data cache 123), this data is sought in level twocombined cache 130. The memory locations of this requested data iseither a hit in level two combined cache 130 or a miss. A hit isserviced from level two combined cache 130. A miss is serviced fromanother level of cache (not illustrated) or from main memory (notillustrated). As is known in the art, the requested instruction may besimultaneously supplied to both level one data cache 123 and centralprocessing unit core 110 to speed use.

Level two combined cache 130 supplies data of a first data stream tostreaming engine 125 via bus 146. Bus 146 is a 512-bit bus in thisexample embodiment. Streaming engine 125 supplies data of this firstdata stream to functional units of vector datapath side B 116 via bus147. Bus 147 is a 512-bit bus in this example embodiment. Level twocombined cache 130 supplies data of a second data stream to streamingengine 125 via bus 148. Bus 148 is a 512-bit bus in this exampleembodiment. Streaming engine 125 supplies data of this second datastream to functional units of vector datapath side B 116 via bus 149.Bus 149 is a 512-bit bus in this example embodiment. Busses 146, 147,148 and 149 are illustrated as unidirectional from level two combinedcache 130 to streaming engine 125 and to vector datapath side B 116 inaccordance with this example embodiment.

Steaming engine data requests are directly fetched from level twocombined cache 130 upon a cache hit (if the requested data is stored inlevel two combined cache 130). Upon a cache miss (the specified data isnot stored in level two combined cache 130), this data is sought fromanother level of cache (not illustrated) or from main memory (notillustrated). In some embodiments, level one data cache 123 may cachedata not stored in level two combined cache 130. If such operation issupported, then upon a streaming engine data request that is a miss inlevel two combined cache 130, level two combined cache 130 may snooplevel one data cache 123 for the streaming engine requested data. Iflevel one data cache 123 stores this data, its snoop response wouldinclude the data, which is then supplied to service the streaming enginerequest. If level one data cache 123 does not store this data, its snoopresponse would indicate this and level two combined cache 130 would thenservice this streaming engine request from another level of cache (notillustrated) or from main memory (not illustrated).

In one embodiment, both level one data cache 123 and level two combinedcache 130 may be configured as selected amounts of cache or directlyaddressable memory in accordance with the aforementioned U.S. Pat. No.6,606,686 entitled UNIFIED MEMORY SYSTEM ARCHITECTURE INCLUDING CACHEAND DIRECTLY ADDRESSABLE STATIC RANDOM ACCESS MEMORY.

FIG. 2 illustrates further details of functional units and registerfiles within scalar datapath side A 115 and vector datapath side B 116in accordance with one example embodiment. Scalar datapath side A 115includes global scalar register file 211, L1/S1 local register file 212,M1/N1 local register file 213 and D1/D2 local register file 214. Scalardatapath side A 115 includes L1 unit 221, S1 unit 222, M1 unit 223, N1unit 224, D1 unit 225 and D2 unit 226. Vector datapath side B 116includes global vector register file 231, L2/S2 local register file 232,M2/N2/C local register file 233 and predicate register file 234. Vectordatapath side B 116 includes L2 unit 241, S2 unit 242, M2 unit 243, N2unit 244, C unit 245 and P unit 246. These functional units may beconfigured to read from or write to certain register files, as will bedetailed below.

L1 unit 221 may accept two 64-bit operands and produce one 64-bitresult. The two operands are each recalled from an instruction specifiedregister in either global scalar register file 211 or L1/S1 localregister file 212. L1 unit 221 may perform the following instructionselected operations: 64-bit add/subtract operations; 32-bit min/maxoperations; 8-bit Single Instruction Multiple Data (SIMD) instructionssuch as sum of absolute value, minimum and maximum determinations;circular min/max operations; and various move operations betweenregister files. The result produced by L1 unit 221 may be written intoan instruction specified register of global scalar register file 211,L1/S1 local register file 212, M1/N1 local register file 213, or D1/D2local register file 214.

S1 unit 222 may accept two 64-bit operands and produce one 64-bitresult. The two operands are each recalled from an instruction specifiedregister in either global scalar register file 211 or L1/S1 localregister file 212. In one embodiment, S1 unit 222 may perform the sametype of operations as L1 unit 221. In other embodiments, there may beslight variations between the data processing operations supported by L1unit 221 and S1 unit 222. The result produced by S1 unit 222 may bewritten into an instruction specified register of global scalar registerfile 211, L1/S1 local register file 212, M1/N1 local register file 213,or D1/D2 local register file 214.

M1 unit 223 may accept two 64-bit operands and produce one 64-bitresult. The two operands are each recalled from an instruction specifiedregister in either global scalar register file 211 or M1/N1 localregister file 213. M1 unit 223 may perform the following instructionselected operations: 8-bit multiply operations; complex dot productoperations; 32-bit bit count operations; complex conjugate multiplyoperations; and bit-wise Logical Operations, moves, adds, and subtracts.The result produced by M1 unit 223 may be written into an instructionspecified register of global scalar register file 211, L1/S1 localregister file 212, M1/N1 local register file 213, or D1/D2 localregister file 214.

N1 unit 224 may accept two 64-bit operands and produce one 64-bitresult. The two operands are each recalled from an instruction specifiedregister in either global scalar register file 211 or M1/N1 localregister file 213. N1 unit 224 may perform the same type operations asM1 unit 223. There may be certain double operations (called dual issuedinstructions) that employ both the M1 unit 223 and the N1 unit 224together. The result produced by N1 unit 224 may be written into aninstruction specified register of global scalar register file 211, L1/S1local register file 212, M1/N1 local register file 213, or D1/D2 localregister file 214.

D1 unit 225 and D2 unit 226 may each accept two 64-bit operands and eachproduce one 64-bit result. D1 unit 225 and D2 unit 226 may performaddress calculations and corresponding load and store operations. D1unit 225 is used for scalar loads and stores of 64 bits. D2 unit 226 isused for vector loads and stores of 512 bits. D1 unit 225 and D2 unit226 also may perform: swapping, pack and unpack on the load and storedata; 64-bit SIMD arithmetic operations; and 64-bit bit-wise logicaloperations. D1/D2 local register file 214 will generally store base andoffset addresses used in address calculations for the correspondingloads and stores. The two operands are each recalled from an instructionspecified register in either global scalar register file 211, or D1/D2local register file 214. The calculated result by D1 unit 225 and/or D2unit 226 may be written into an instruction specified register of globalscalar register file 211, L1/S1 local register file 212, M1/N1 localregister file 213, or D1/D2 local register file 214.

L2 unit 241 may accept two 512-bit operands and produce one 512-bitresult. Each of up to two operands are each recalled from an instructionspecified register in either global vector register file 231, L2/S2local register file 232 or predicate register file 234. L2 unit 241 mayperform instruction similar to L1 unit 221 except on wider 512-bit data.The result produced by L2 unit 241 may be written into an instructionspecified register of global vector register file 231, L2/S2 localregister file 232, M2/N2/C local register file 233, or predicateregister file 234.

S2 unit 242 may accept two 512-bit operands and produce one 512-bitresult. Each of up to two operands are each recalled from an instructionspecified register in either global vector register file 231, L2/S2local register file 232 or predicate register file 234. S2 unit 242 mayperform instructions similar to S1 unit 222 except on wider 512-bitdata. The result produced by S2 unit 242 may be written into aninstruction specified register of global vector register file 231, L2/S2local register file 232, M2/N2/C local register file 233, or predicateregister file 234.

M2 unit 243 may accept two 512-bit operands and produce one 512-bitresult. The two operands are each recalled from an instruction specifiedregister in either global vector register file 231 or M2/N2/C localregister file 233. M2 unit 243 may perform instructions similar to M1unit 223 except on wider 512-bit data. The result produced by M2 unit243 may be written into an instruction specified register of globalvector register file 231, L2/S2 local register file 232, or M2/N2/Clocal register file 233.

N2 unit 244 may accept two 512-bit operands and produce one 512-bitresult. The two operands are each recalled from an instruction specifiedregister in either global vector register file 231 or M2/N2/C localregister file 233. N2 unit 244 may perform the same type operations asM2 unit 243. There may be certain double operations (called dual issuedinstructions) that employ both M2 unit 243 and the N2 unit 244 together.The result produced by N2 unit 244 may be written into an instructionspecified register of global vector register file 231, L2/S2 localregister file 232, or M2/N2/C local register file 233.

C unit 245 may accepts two 512-bit operands and produce one 512-bitresult. The two operands are each recalled from an instruction specifiedregister in either global vector register file 231 or M2/N2/C localregister file 233. C unit 245 may perform: “Rake” and “Search”instructions; up to 512 2-bit PN*8-bit multiplies; I/Q complexmultiplies per clock cycle; 8-bit and 16-bit Sum-of-Absolute-Difference(SAD) calculations, up to 512 SADs per clock cycle; horizontal add andhorizontal min/max instructions; and vector permutes instructions. Inone embodiment, C unit 245 includes 4 vector control registers (CUCR0 toCUCR3) used to control certain operations of C unit 245 instructions.Control registers CUCR0 to CUCR3 are used as operands in certain C unit245 operations. For example, control registers CUCR0 to CUCR3 may beused in control of a general permutation instruction (VPERM) or as masksfor SIMD multiple DOT product operations (DOTPM) and SIMD multipleSum-of-Absolute-Difference (SAD) operations. Control register CUCR0 maybe used to store polynomials for Galois Field Multiply operations(GFMPY). Control register CUCR1 may be used to store a Galois fieldpolynomial generator function.

P unit 246 may perform basic logic operations on registers of localpredicate register file 234. P unit 246 has direct access to read fromand write to predicate register file 234. The operations performed by Punit 246 may include AND, ANDN, OR, XOR, NOR, BITR, NEG, SET, BITCNT,RMBD, BIT Decimate and Expand. One use of P unit 246 can includemanipulation of an SIMD vector comparison result for use in control of afurther SIMD vector operation.

FIG. 3 illustrates an example embodiment of global scalar register file211. In the illustrated embodiment, there are 16 independent 64-bit widescalar registers designated A0 to A15. Each register of global scalarregister file 211 can be read from or written to as 64-bits of scalardata. All scalar datapath side A 115 functional units (L1 unit 221, S1unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226) canread or write to global scalar register file 211. Global scalar registerfile 211 may be read as 32-bits or as 64-bits and may only be written toas 64-bits. The instruction executing determines the read data size.Vector datapath side B 116 functional units (L2 unit 241, S2 unit 242,M2 unit 243, N2 unit 244, C unit 245, and P unit 246) can read fromglobal scalar register file 211 via crosspath 117 under restrictionsthat will be detailed below.

FIG. 4 illustrates an example embodiment of D1/D2 local register file214. In the illustrated embodiment, there are 16 independent 64-bit widescalar registers designated D0 to D16. Each register of D1/D2 localregister file 214 can be read from or written to as 64-bits of scalardata. All scalar datapath side A 115 functional units (L1 unit 221, S1unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226) canwrite to D1/D2 local register file 214. Only D1 unit 225 and D2 unit 226can read from D1/D2 local register file 214. Data stored in D1/D2 localregister file 214 may include base addresses and offset addresses usedin address calculations.

FIG. 5 illustrates an example embodiment of L1/S1 local register file212. The embodiment illustrated in FIG. 5 has 8 independent 64-bit widescalar registers designated AL0 to AL7. Under certain instruction codingformats (see FIG. 13 ), L1/S1 local register file 212 can include up to16 registers. The embodiment of FIG. 5 implements only 8 registers toreduce circuit size and complexity. Each register of L1/S1 localregister file 212 can be read from or written to as 64-bits of scalardata. All scalar datapath side A 115 functional units (L1 unit 221, S1unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226) canwrite to L1/S1 local register file 212. Only L1 unit 221 and S1 unit 222can read from L1/S1 local register file 212.

FIG. 6 illustrates an example embodiment of M1/N1 local register file213. The embodiment illustrated in FIG. 6 has 8 independent 64-bit widescalar registers designated AM0 to AM7. Under certain instruction codingformats (see FIG. 13 ), M1/N1 local register file 213 can include up to16 registers. The embodiment of FIG. 6 implements only 8 registers toreduce circuit size and complexity. Each register of M1/N1 localregister file 213 can be read from or written to as 64-bits of scalardata. All scalar datapath side A 115 functional units (L1 unit 221, S1unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226) canwrite to M1/N1 local register file 213. Only M1 unit 223 and N1 unit 224can read from M1/N1 local register file 213.

FIG. 7 illustrates an example embodiment of global vector register file231. In the illustrated embodiment, there are 16 independent 512-bitwide vector registers. Each register of global vector register file 231can be read from or written to as 64-bits of scalar data designated B0to B15. Each register of global vector register file 231 can be readfrom or written to as 512-bits of vector data designated VB0 to VB15.The instruction type determines the data size. All vector datapath sideB 116 functional units (L2 unit 241, S2 unit 242, M2 unit 243, N2 unit244, C unit 245, and P unit 246) can read or write to global vectorregister file 231. Scalar datapath side A 115 functional units (L1 unit221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit226) can read from global vector register file 231 via crosspath 117under restrictions that will be detailed below.

FIG. 8 illustrates an example embodiment of P local register file 234.In the illustrated embodiment, there are 8 independent 64-bit wideregisters designated P0 to P7. Each register of P local register file234 can be read from or written to as 64-bits of scalar data. Vectordatapath side B 116 functional units L2 unit 241, S2 unit 242, C unit244, and P unit 246 can write to P local register file 234. Only L2 unit241, S2 unit 242, and P unit 246 can read from P local register file234. P local register file 234 may be used for: writing one bit SIMDvector comparison results from L2 unit 241, S2 unit 242, or C unit 245;manipulation of SIMD vector comparison results by P unit 246; and use ofthe manipulated results in control of a further SIMD vector operation.

FIG. 9 illustrates an example embodiment of L2/S2 local register file232. The embodiment illustrated in FIG. 9 has 8 independent 512-bit widevector registers. Under certain instruction coding formats (see FIG. 13), L2/S2 local register file 232 can include up to 16 registers. Theembodiment of FIG. 9 implements only 8 registers to reduce circuit sizeand complexity. Each register of L2/S2 local vector register file 232can be read from or written to as 64-bits of scalar data designated BL0to BL7. Each register of L2/S2 local vector register file 232 can beread from or written to as 512-bits of vector data designated VBL0 toVBL7. The instruction type determines the data size. All vector datapathside B 116 functional units (L2 unit 241, S2 unit 242, M2 unit 243, N2unit 244, C unit 245, and P unit 246) can write to L2/S2 local registerfile 232. Only L2 unit 241 and S2 unit 242 can read from L2/S2 localvector register file 232.

FIG. 10 illustrates an example embodiment of M2/N2/C local register file233. The embodiment illustrated in FIG. 10 has 8 independent 512-bitwide vector registers. Under certain instruction coding formats (seeFIG. 13 ), M2/N2/C local register file 233 can include up to 16registers. The embodiment of FIG. 10 implements only 8 registers toreduce circuit size and complexity. Each register of M2/N2/C localvector register file 233 can be read from or written to as 64-bits ofscalar data designated BM0 to BM7. Each register of M2/N2/C local vectorregister file 233 can be read from or written to as 512-bits of vectordata designated VBM0 to VBM7. All vector datapath side B 116 functionalunits (L2 unit 241, S2 unit 242, M2 unit 243, N2 unit 244, C unit 245,and P unit 246) can write to M2/N2/C local vector register file 233.Only M2 unit 233, N2 unit 244 and C unit 245 can read from M2/N2/C localvector register file 233.

Thus, in accordance with certain disclosed embodiments of thisdisclosure, global register files may be accessible by all functionalunits of a side (e.g., scalar and vector) and local register files maybe accessible by only some of the functional units of a side. Someadditional embodiments in accordance with this disclosure could bepracticed employing only one type of register file corresponding to thedisclosed global register files.

Crosspath 117 permits limited exchange of data between scalar datapathside A 115 and vector datapath side B 116. During each operational cycleone 64-bit data word can be recalled from global scalar register file211 for use as an operand by one or more functional units of vectordatapath side B 116 and one 64-bit data word can be recalled from globalvector register file 231 for use as an operand by one or more functionalunits of scalar datapath side A 115. Any scalar datapath side A 115functional unit (L1 unit 221, S1 unit 222, M1 unit 223, N1 unit 224, D1unit 225, and D2 unit 226) may read a 64-bit operand from global vectorregister file 231. This 64-bit operand is the least significant bits ofthe 512-bit data in the accessed register of global vector register file231. Scalar datapath side A 115 functional units may employ the same64-bit crosspath data as an operand during the same operational cycle.However, only one 64-bit operand is transferred from vector datapathside B 116 to scalar datapath side A 115 in any single operationalcycle. Any vector datapath side B 116 functional unit (L2 unit 241, S2unit 242, M2 unit 243, N2 unit 244, C unit 245, and P unit 246) may reada 64-bit operand from global scalar register file 211. If thecorresponding instruction is a scalar instruction, the crosspath operanddata is treated as any other 64-bit operand. If the correspondinginstruction is a vector instruction, the upper 448 bits of the operandare zero filled. Vector datapath side B 116 functional units may employthe same 64-bit crosspath data as an operand during the same operationalcycle. Only one 64-bit operand is transferred from scalar datapath sideA 115 to vector datapath side B 116 in any single operational cycle.

Streaming engine 125 transfers data in certain circumstances. In theembodiment of FIG. 1 , streaming engine 125 controls two data streams. Astream includes a sequence of elements of a particular type. Programsthat operate on streams read the data sequentially, operating on eachelement in turn. Stream data may have the following basic properties: awell-defined beginning and ending time; fixed element size and typethroughout the stream; and a fixed sequence of elements. Thus programscannot seek randomly within the stream. Further, stream data isread-only while active. Thus, programs cannot write to a stream whilesimultaneously reading from it. Once a stream is opened, streamingengine 125: calculates the address; fetches the defined data type fromlevel two unified cache 130 (which may require cache service from ahigher level memory, i.e., in the event of a cache miss in level twounified cache 130); performs data type manipulation (e.g., such as zeroextension, sign extension, and/or data element sorting/swapping such asmatrix transposition); and delivers the data directly to the programmeddata register file within CPU 110. Streaming engine 125 is thus usefulfor real-time digital filtering operations on well-behaved data.Streaming engine 125 frees these memory fetch tasks from thecorresponding CPU 110, thereby enabling the CPU 110 to perform otherprocessing functions.

Streaming engine 125 provides several benefits. For example, streamingengine 125 permits multi-dimensional memory accesses, increases theavailable bandwidth to functional units of CPU 110, reduces the numberof cache miss stalls since the stream buffer bypasses level one datacache 123, reduces the number of scalar operations required to maintaina loop, and manages address pointers. Streaming engine 125 can alsohandle address generation, which frees up address generation instructionslots and D1 unit 225 and D2 unit 226 for other computations.

CPU 110 operates on an instruction pipeline. Instructions are fetched ininstruction packets of a fixed length as further described below. Allinstructions have the same number of pipeline phases for fetch anddecode, but can have a varying number of execute phases.

FIG. 11 illustrates an example embodiment of an instruction pipelinehaving the following pipeline phases: program fetch phase 1110, dispatchand decode phases 1120, and execution phase 1130. Program fetch phase1110 includes three stages for all instructions. Dispatch and decodephases 1120 include three stages for all instructions. Execution phase1130 includes one to four stages dependent on the instruction.

Fetch phase 1110 includes program address generation stage 1111 (PG),program access stage 1112 (PA), and program receive stage 1113 (PR).During program address generation stage 1111 (PG), a program address isgenerated in the CPU and a read request is sent to a memory controllerfor the level one instruction cache L1I. During the program access stage1112 (PA), the level one instruction cache L1I processes the request,accesses the data in its memory, and sends a fetch packet to the CPUboundary. During the program receive stage 1113 (PR), the CPU registersthe fetch packet.

In an example embodiment, instructions are fetched as sixteen 32-bitwide slots, constituting a fetch packet, at a time. FIG. 12 illustratesone such embodiment, where a single fetch packet includes sixteeninstructions 1201 to 1216. Fetch packets are aligned on 512-bit(16-word) boundaries. The fetch packet, in one embodiment, employs afixed 32-bit instruction length. Fixed length instructions areadvantageous for several reasons. Fixed length instructions enable easydecoder alignment. A properly aligned instruction fetch can load pluralinstructions into parallel instruction decoders. Such a properly alignedinstruction fetch can be achieved by predetermined instruction alignmentwhen stored in memory (fetch packets aligned on 512-bit boundaries)coupled with a fixed instruction packet fetch. An aligned instructionfetch also permits operation of parallel decoders on instruction-sizedfetched bits. Variable length instructions may require an initial stepof locating each instruction boundary before they can be decoded. Afixed length instruction set generally permits more regular layout ofinstruction fields. This simplifies the construction of each decoderwhich is an advantage for a wide issue VLIW central processor.

The execution of the individual instructions is partially controlled bya p bit in each instruction. This p bit can be configured as bit 0 ofthe 32-bit wide slot. The p bit of an instruction determines whether theinstruction executes in parallel with a next instruction. Instructionsare scanned from lower to higher addresses. If the p bit of aninstruction is 1, then the next following instruction (higher memoryaddress) is executed in parallel with (in the same cycle as) thatinstruction. If the p bit of an instruction is 0, then the nextfollowing instruction is executed in the cycle after the instruction.

CPU 110 and level one instruction cache L1I 121 pipelines are de-coupledfrom each other. Fetch packet returns from level one instruction cacheL1I can take different number of clock cycles, depending on externalcircumstances such as whether there is a hit in level one instructioncache 121 or a hit in level two combined cache 130. Therefore programaccess stage 1112 (PA) can take several clock cycles instead of 1 clockcycle as in the other stages.

The instructions executing in parallel constitute an execute packet. Inone embodiment, an execute packet can contain up to sixteen instructions(slots). No two instructions in an execute packet may use the samefunctional unit. A slot can be one of five types: 1) a self-containedinstruction executed on one of the functional units of CPU 110 (L1 unit221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, D2 unit 226, L2unit 241, S2 unit 242, M2 unit 243, N2 unit 244, C unit 245, and P unit246); 2) a unitless instruction such as a NOP (no operation) instructionor multiple NOP instructions; 3) a branch instruction; 4) a constantfield extension; and 5) a conditional code extension. Some of these slottypes will be further explained below.

Dispatch and decode phases 1120 include instruction dispatch toappropriate execution unit stage 1121 (DS), instruction pre-decode stage1122 (DC1), and instruction decode, operand reads stage 1123 (DC2).During instruction dispatch to appropriate execution unit stage 1121(DS) the fetch packets are split into execute packets and assigned tothe appropriate functional units. During the instruction pre-decodestage 1122 (DC1), the source registers, destination registers, andassociated paths are decoded for the execution of the instructions inthe functional units. During the instruction decode, operand reads stage1123 (DC2), more detailed unit decodes are done, as well as readingoperands from the register files.

Execution phase 1130 includes execution stages 1131 to 1135 (E1 to E5).Different types of instructions may require different numbers of thesestages to complete their execution. These stages of the pipeline play animportant role in understanding the device state at CPU cycleboundaries.

During execute 1 stage 1131 (E1), the conditions for the instructionsare evaluated and operands are operated on. As illustrated in FIG. 11 ,execute 1 stage 1131 may receive operands from a stream buffer 1141 andone of the register files shown schematically as 1142. For load andstore instructions, address generation is performed and addressmodifications are written to a register file. For branch instructions, abranch fetch packet in PG phase is affected.

As illustrated in FIG. 11 , load and store instructions access memory,shown here schematically as memory 1151. For single-cycle instructions,results are written to a destination register file. This assumes thatany conditions for the instructions are evaluated as true. If acondition is evaluated as false, the instruction does not write anyresults or have any pipeline operation after execute 1 stage 1131.

During execute 2 stage 1132 (E2), load instructions send the address tomemory. Store instructions send the address and data to memory.Single-cycle instructions that saturate results set a bit (SAT) in thecontrol status register (CSR) if saturation occurs. For 2-cycleinstructions, results are written to a destination register file.

During execute 3 stage 1133 (E3), data memory accesses are performed.Any multiply instructions that saturate results set the SAT bit in thecontrol status register (CSR) if saturation occurs. For 3-cycleinstructions, results are written to a destination register file.

During execute 4 stage 1134 (E4), load instructions bring data to theCPU boundary. For 4-cycle instructions, results are written to adestination register file.

During execute 5 stage 1135 (E5), load instructions write data into aregister. This is illustrated schematically in FIG. 11 with input frommemory 1151 to execute 5 stage 1135.

FIG. 13 illustrates an instruction coding format 1300 of functional unitinstructions in accordance with an example embodiment. Those skilled inthe art would realize that other instruction codings are feasible andwithin the scope of this disclosure. In the illustrated embodiment, eachinstruction includes 32 bits and controls the operation of one of theindividually controllable functional units (L1 unit 221, S1 unit 222, M1unit 223, N1 unit 224, D1 unit 225, D2 unit 226, L2 unit 241, S2 unit242, M2 unit 243, N2 unit 244, C unit 245, and P unit 246). The bitfields of instruction coding 1300 are defined as follows.

The creg field 1301 (bits 29 to 31) and the z bit 1302 (bit 28) arefields used in conditional instructions. These bits are used forconditional instructions to identify a predicate (also referred to as“conditional”) register and a condition. The z bit 1302 (bit 28)indicates whether the condition is based upon zero or not zero in thepredicate register. If z=1, the test is for equality with zero. If z=0,the test is for nonzero. For unconditional instructions, the creg field1301 and z bit 1302 are set to all 0s to allow unconditional instructionexecution. The creg field 1301 and the z field 1302 are encoded in theinstruction as shown in Table 1.

TABLE 1 Conditional creg z Register 31 30 29 28 Unconditional 0 0 0 0Reserved 0 0 0 1 A0 0 0 1 z A1 0 1 0 z A2 0 1 1 z A3 1 0 0 z A4 1 0 1 zA5 1 1 0 z Reserved 1 1 x x

Execution of a conditional instruction is conditional upon the valuestored in the specified conditional data register. In this illustratedexample, the conditional register is a data register in the globalscalar register file 211. The “z” in the z bit column refers to thezero/not zero comparison selection noted above, and “x” is a do not carestate. In this example, the use of three bits for the creg field 1301 inthis coding allows for specifying only a subset (A0-A5) of the 16 globalregisters of global scalar register file 211 as predicate registers.This selection was made to preserve bits in the instruction coding andreduce opcode space.

The dst field 1303 (bits 23 to 27) specifies a register in acorresponding register file as the destination of the instructionresults (e.g., where the results are to be written).

The src2/cst field 1304 (bits 18 to 22) can be interpreted in differentways depending on the instruction opcode field (bits 4 to 12 for allinstructions and additionally bits 28 to 31 for unconditionalinstructions). The src2/cst field 1304 indicates a second sourceoperand, either from a register of a corresponding register file or as aconstant depending on the instruction opcode field. Depending on theinstruction type, when the second source operand is a constant, this maybe treated as an unsigned integer and zero extended to a specified datalength or may be treated as a signed integer and sign extended to thespecified data length.

The src1 field 1305 (bits 13 to 17) specifies a register in acorresponding register file as a first source operand.

The opcode field 1306 (bits 4 to 12) for all instructions (andadditionally bits 28 to 31 for unconditional instructions) specifies thetype of instruction and designates appropriate instruction options. Thisincludes designation of the functional unit used and the operationperformed. Additional details regarding such instruction options aredetailed below.

The e bit 1307 (bit 2) is used for immediate constant instructions wherethe constant may be extended. If e=1, then the immediate constant isextended in a manner detailed below. If e=0, then the immediate constantis not extended. In the latter case, the immediate constant is specifiedby the src2/cst field 1304 (bits 18 to 22). The e bit 1307 may be usedfor only some types of instructions. Accordingly, with proper coding,the e bit 1307 may be omitted from instructions which do not need it,and this bit can instead be used as an additional opcode bit.

The s bit 1308 (bit 1) designates scalar datapath side A 115 or vectordatapath side B 116. If s=0, then scalar datapath side A 115 isselected, and the available functional units (L1 unit 221, S1 unit 222,M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226) and registerfiles (global scalar register file 211, L1/S1 local register file 212,M1/N1 local register file 213, and D1/D2 local register file 214) willbe those corresponding to scalar datapath side A 115 as illustrated inFIG. 2 . Similarly, s=1 selects vector datapath side B 116, and theavailable functional units (L2 unit 241, S2 unit 242, M2 unit 243, N2unit 244, C unit 245, and P unit 246) and register files (global vectorregister file 231, L2/S2 local register file 232, M2/N2/C local registerfile 233, and predicate local register file 234) will be thosecorresponding to vector datapath side B 116 as illustrated in FIG. 2 .

The p bit 1308 (bit 0) is used to determine whether the instructionexecutes in parallel with the following instruction. The p-bits arescanned from lower to higher addresses. If p=1 for the currentinstruction, then the next instruction executes in parallel with thecurrent instruction. If p=0 for the current instruction, then the nextinstruction executes in the cycle after the current instruction. Allinstructions executing in parallel constitute an execute packet. In oneexample embodiment, an execute packet can contain up to twelveinstructions for parallel execution, with each instruction in an executepacket assigned to a different functional unit.

In one example embodiment of processor 100, there are two differentcondition code extension slots (slot 0 and slot 1). The condition codeextension slots may be 32-bit in this example embodiment, as with thecoding format 1300 described in FIG. 13 . Each execute packet cancontain one each of these 32-bit condition code extension slots, whichcontains the 4-bit creg/z fields (e.g., similar to bits 28 to 31 ofcoding 1300) for the instructions in the same execute packet. FIG. 14illustrates an example coding for condition code extension slot 0 andFIG. 15 illustrates an example coding for condition code extension slot1.

FIG. 14 illustrates an example coding 1400 for condition code extensionslot 0. Field 1401 (bits 28 to 31) specify 4 creg/z bits assigned to theL1 unit 221 instruction in the same execute packet. Field 1402 (bits 27to 24) specify 4 creg/z bits assigned to the L2 unit 241 instruction inthe same execute packet. Field 1403 (bits 19 to 23) specify 4 creg/zbits assigned to the S1 unit 222 instruction in the same execute packet.Field 1404 (bits 16 to 19) specify 4 creg/z bits assigned to the S2 unit242 instruction in the same execute packet. Field 1405 (bits 12 to 15)specify 4 creg/z bits assigned to the D1 unit 225 instruction in thesame execute packet. Field 1406 (bits 8 to 11) specify 4 creg/z bitsassigned to the D2 unit 226 instruction in the same execute packet.Field 1407 (bits 6 and 7) is unused/reserved. Field 1408 (bits 0 to 5)is coded with a set of unique bits (CCEX0) to identify the conditioncode extension slot 0. Once this unique ID of condition code extensionslot 0 is detected, the corresponding creg/z bits are employed tocontrol conditional execution of any L1 unit 221, L2 unit 241, S1 unit222, S2 unit 242, D1 unit 225, and D2 unit 226 instructions in the sameexecution packet. These creg/z bits are interpreted as shown in Table 1.If the corresponding instruction is conditional (e.g., creg/z bits arenot all 0) the corresponding bits in the condition code extension slot 0override the condition code bits (bits 28 to 31 of creg field 1301 and zbit 1302) in the instruction (e.g., coded using coding format 1300). Inthe illustrated example, no execution packet can have more than oneinstruction directed to a particular execution unit, and no executepacket of instructions can contain more than one condition codeextension slot 0. Thus, the mapping of creg/z bits to functional unitinstructions is unambiguous. As discussed above, setting the creg/z bitsequal to “0000” makes the instruction unconditional. Thus, a properlycoded condition code extension slot 0 can make some correspondinginstructions conditional and some unconditional.

FIG. 15 illustrates an example coding 1500 for condition code extensionslot 1. Field 1501 (bits 28 to 31) specify 4 creg/z bits assigned to theM1 unit 223 instruction in the same execute packet. Field 1502 (bits 27to 24) specify 4 creg/z bits assigned to the M2 unit 243 instruction inthe same execute packet. Field 1503 (bits 19 to 23) specify 4 creg/zbits assigned to the C unit 245 instruction in the same execute packet.Field 1504 (bits 16 to 19) specify 4 creg/z bits assigned to the N1 unit224 instruction in the same execute packet. Field 1505 (bits 12 to 15)specify 4 creg/z bits assigned to the N2 unit 244 instruction in thesame execute packet. Field 1506 (bits 6 to 11) is unused/reserved. Field1507 (bits 0 to 5) is coded with a set of unique bits (CCEX1) toidentify the condition code extension slot 1. Once this unique ID ofcondition code extension slot 1 is detected, the corresponding creg/zbits are employed to control conditional execution of any M1 unit 223,M2 unit 243, C unit 245, N1 unit 224 and N2 unit 244 instructions in thesame execution packet. These creg/z bits are interpreted as shown inTable 1. If the corresponding instruction is conditional (e.g., creg/zbits are not all 0) the corresponding bits in the condition codeextension slot 1 override the condition code bits (bits 28 to 31 of cregfield 1301 and z bit 1302) in the instruction (e.g., coded using codingformat 1300). In the illustrated example, no execution packet can havemore than one instruction directed to a particular execution unit, andno execute packet of instructions can contain more than one conditioncode extension slot 1. Thus, the mapping of creg/z bits to functionalunit instruction is unambiguous. As discussed above, setting the creg/zbits equal to “0000” makes the instruction unconditional. Thus, aproperly coded condition code extension slot 1 can make someinstructions conditional and some unconditional.

Both condition code extension slot 0 1400 and condition code extensionslot 1 may include a p bit to define an execute packet as describedabove in conjunction with FIG. 13 . In one example embodiment, asillustrated in FIGS. 14 and 15 , bit 0 of code extension slot 0 1400 andcondition code extension slot 1 1500 may provide the p bit. Assuming thep bit for the code extension slots 1400, 1500 is always encoded as 1(parallel execution), neither code extension slot 1400, 1500 should bethe last instruction slot of an execute packet.

In one example embodiment of processor 100, there are two differentconstant extension slots. Each execute packet can contain one each ofthese unique 32-bit constant extension slots which contains 27 bits tobe concatenated as high order bits with a 5-bit constant field in theinstruction coding 1300 to form a 32-bit constant. As noted in theinstruction coding 1300 description above, only some instructions definethe 5-bit src2/cst field 1304 as a constant rather than a sourceregister identifier. At least some of those instructions may employ aconstant extension slot to extend this constant to 32 bits.

FIG. 16 illustrates an example coding 1600 of constant extension slot 0.Each execute packet may include one instance of constant extension slot0 and one instance of constant extension slot 1. FIG. 16 illustratesthat constant extension slot 0 1600 includes two fields. Field 1601(bits 5 to 31) constitute the most significant 27 bits of an extended32-bit constant with the target instruction scr2/cst field 1304providing the five least significant bits. Field 1602 (bits 0 to 4) arecoded a set of unique bits (CSTX0) to identify the constant extensionslot 0. In an example embodiment constant extension slot 0 1600 is usedto extend the constant of one of an L1 unit 221 instruction, data in aD1 unit 225 instruction, an S2 unit 242 instruction, an offset in a D2unit 226 instruction, an M2 unit 243 instruction, an N2 unit 244instruction, a branch instruction, or a C unit 245 instruction in thesame execute packet. Constant extension slot 1 is similar to constantextension slot 0 except that bits 0 to 4 are coded a set of unique bits(CSTX1) to identify the constant extension slot 1. In an exampleembodiment, constant extension slot 1 is used to extend the constant ofone of an L2 unit 241 instruction, data in a D2 unit 226 instruction, anS1 unit 222 instruction, an offset in a D1 unit 225 instruction, an M1unit 223 instruction, or an N1 unit 224 instruction in the same executepacket.

Constant extension slot 0 and constant extension slot 1 are used asfollows. The target instruction must be of the type permitting constantspecification. As known in the art this is implemented by replacing oneinput operand register specification field with the least significantbits of the constant as described above with respect to scr2/cst field1304. Instruction decoder 113 determines this case, known as animmediate field, from the instruction opcode bits. The targetinstruction also includes one constant extension bit (e bit 1307)dedicated to signaling whether the specified constant is not extended(e.g., constant extension bit=0) or the constant is extended (e.g.,constant extension bit=1). If instruction decoder 113 detects a constantextension slot 0 or a constant extension slot 1, it further checks theother instructions within that execute packet for an instructioncorresponding to the detected constant extension slot. A constantextension is made when a corresponding instruction has a constantextension bit (e bit 1307) equal to 1.

FIG. 17 is a block diagram 1700 illustrating constant extension logicthat may be implemented in processor 100. FIG. 17 assumes thatinstruction decoder 113 detects a constant extension slot and acorresponding instruction in the same execute packet. Instructiondecoder 113 supplies the 27 extension bits from the constant extensionslot (bit field 1601) and the 5 constant bits (bit field 1304) from thecorresponding instruction to concatenator 1701. Concatenator 1701 formsa single 32-bit word from these two parts. In the illustratedembodiment, the 27 extension bits from the constant extension slot (bitfield 1601) are the most significant bits and the 5 constant bits (bitfield 1305) are the least significant bits. This combined 32-bit word issupplied to one input of multiplexer 1702. The 5 constant bits from thecorresponding instruction field 1305 supply a second input tomultiplexer 1702. Selection of multiplexer 1702 is controlled by thestatus of the constant extension bit. If the constant extension bit (ebit 1307) is 1 (extended), multiplexer 1702 selects the concatenated32-bit input. If the constant extension bit is 0 (not extended),multiplexer 1702 selects the 5 constant bits from the correspondinginstruction field 1305. Multiplexer 1702 supplies this output to aninput of sign extension unit 1703.

Sign extension unit 1703 forms the final operand value from the inputfrom multiplexer 1703. Sign extension unit 1703 receives control inputsScalar/Vector and Data Size. The Scalar/Vector input indicates whetherthe corresponding instruction is a scalar instruction or a vectorinstruction. The functional units of data path side A 115 (L1 unit 221,S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225 and D2 unit 226) are,in this embodiment, limited to performing scalar instructions. Anyinstruction directed to one of these functional units is a scalarinstruction. Data path side B functional units L2 unit 241, S2 unit 242,M2 unit 243, N2 unit 244 and C unit 245 may perform scalar instructionsor vector instructions. Instruction decoder 113 determines whether theinstruction is a scalar instruction or a vector instruction from theopcode bits. P unit 246 may only perform scalar instructions in thisembodiment. The Data Size may be 8 bits (byte B), 16 bits (half-word H),32 bits (word W), 64 bits (double word D), quad word (128 bit) data orhalf vector (256 bit) data.

Table 2 lists the operation of sign extension unit 1703 for the variousoptions.

TABLE 2 Instruction Operand Constant Type Size Length Action ScalarB/H/W/D  5 bits Sign extend to 64 bits Scalar B/H/W/D 32 bits Signextend to 64 bits Vector B/H/W/D  5 bits Sign extend to operand size andreplicate across the whole vector Vector B/H/W 32 bits Replicate 32-bitconstant across each 32-bit (W) lane Vector D 32 bits Sign extend to 64bits and replicate across each 64-bit (D) lane

Both constant extension slot 0 and constant extension slot 1 may includea p bit to define an execute packet as described above in conjunctionwith FIG. 13 . In one example embodiment, as in the case of thecondition code extension slots, bit 0 of constant extension slot 0 andconstant extension slot 1 may provide the p bit. Assuming the p bit forconstant extension slot 0 and constant extension slot 1 is alwaysencoded as 1 (parallel execution), neither constant extension slot 0 norconstant extension slot 1 should be in the last instruction slot of anexecute packet.

In some embodiments, an execute packet can include a constant extensionslot 0 or 1 and more than one corresponding instruction marked constantextended (e bit=1). For constant extension slot 0, this would mean morethan one of an L1 unit 221 instruction, data in a D1 unit 225instruction, an S2 unit 242 instruction, an offset in a D2 unit 226instruction, an M2 unit 243 instruction, or an N2 unit 244 instructionin an execute packet have an e bit of 1. For constant extension slot 1this would mean more than one of an L2 unit 241 instruction, data in aD2 unit 226 instruction, an S1 unit 222 instruction, an offset in a D1unit 225 instruction, an M1 unit 223 instruction or an N1 unit 224instruction in an execute packet have an e bit of 1. In such instances,instruction decoder 113 may, in one embodiment, determine this case aninvalid and unsupported operation. In another embodiment, thiscombination may be supported with extension bits of the constantextension slot applied to each corresponding functional unit instructionmarked constant extended.

Special vector predicate instructions use registers in predicateregister file 234 to control vector operations. In the currentembodiment, all the SIMD vector predicate instructions operate onselected data sizes. The data sizes may include byte (8 bit) data, halfword (16 bit) data, word (32 bit) data, double word (64 bit) data, quadword (128 bit) data and half vector (256 bit) data. Each bit of thepredicate register controls whether a SIMD operation is performed uponthe corresponding byte of data. The operations of P unit 246 permit avariety of compound vector SIMD operations based upon more than onevector comparison. For example, a range determination can be made usingtwo comparisons. A candidate vector is compared with a first vectorreference having the minimum of the range packed within a first dataregister. A second comparison of the candidate vector is made with asecond reference vector having the maximum of the range packed within asecond data register. Logical combinations of the two resultingpredicate registers would permit a vector conditional operation todetermine whether each data part of the candidate vector is within rangeor out of range.

L1 unit 221, S1 unit 222, L2 unit 241, S2 unit 242 and C unit 245 oftenoperate in a single instruction multiple data (SIMD) mode. In this SIMDmode, the same instruction is applied to packed data from the twooperands. Each operand holds plural data elements disposed inpredetermined slots. SIMD operation is enabled by carry control at thedata boundaries. Such carry control enables operations on varying datawidths.

FIG. 18 illustrates the carry control. AND gate 1801 receives the carryoutput of bit N within the operand wide arithmetic logic unit (64 bitsfor scalar datapath side A 115 functional units and 512 bits for vectordatapath side B 116 functional units). AND gate 1801 also receives acarry control signal which will be further explained below. The outputof AND gate 1801 is supplied to the carry input of bit N+1 of theoperand wide arithmetic logic unit. AND gates such as AND gate 1801 aredisposed between every pair of bits at a possible data boundary. Forexample, for 8-bit data, such an AND gate will be between bits 7 and 8,bits 15 and 16, bits 23 and 24, etc. Each such AND gate receives acorresponding carry control signal. If the data size is of the minimum,then each carry control signal is 0, effectively blocking carrytransmission between the adjacent bits. The corresponding carry controlsignal is 1 if the selected data size requires both arithmetic logicunit sections. Table 3 below shows example carry control signals for thecase of a 512-bit wide operand, such as used by vector datapath side B116 functional units, which may be divided into sections of 8 bits, 16bits, 32 bits, 64 bits, 128 bits, or 256 bits. In Table 3 the upper 32bits control the upper bits (bits 128 to 511) carries and the lower 32bits control the lower bits (bits 0 to 127) carries. No control of thecarry output of the most significant bit is needed, thus only 63 carrycontrol signals are required.

TABLE 3 Data Size Carry Control Signals  8 bits (B) −000 0000 0000 00000000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 16 bits (H)−101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 01010101 0101  32 bits (W) −111 0111 0111 0111 0111 0111 0111 0111 0111 01110111 0111 0111 0111 0111 0111 64 bits (D) −111 1111 0111 1111 0111 11110111 1111 0111 1111 0111 1111 0111 1111 0111 1111 128 bits    −111 11111111 1111 0111 1111 1111 1111 0111 1111 1111 1111 0111 1111 1111 1111256 bits    −111 1111 1111 1111 1111 1111 1111 1111 0111 1111 1111 11111111 1111 1111 1111

It is typical in the art to operate on data sizes that are integralpowers of 2 (2^(N)). However, this carry control technique is notlimited to integral powers of 2. One skilled in the art would understandhow to apply this technique to other data sizes and other operandwidths.

Processor 100 includes dedicated instructions to perform table look upoperations implemented via one of D1 unit 225 or D2 unit 226. The tablesfor these table look up operations are mapped into level one data cache123 directly addressable memory. An example of such a table/cacheconfiguration is disclosed in accordance with U.S. Pat. No. 6,606,686entitled UNIFIED MEMORY SYSTEM ARCHITECTURE INCLUDING CACHE AND DIRECTLYADDRESSABLE STATIC RANDOM ACCESS MEMORY. These tables may be loaded bynormal memory operations, such as via a direct memory access (DMA) port,by a special purpose LUTINIT instruction (described below), or just anormal store instruction to the memory space containing the tables. Inone example embodiment, processor 100 supports up to 4 separate sets ofparallel look up tables and, within a set, up to 16 tables can be lookedup in parallel with byte, half word or word element sizes. In accordancewith this embodiment, at least the portion of level one data cache 123devoted to directly addressed memory has 16 banks. This permits parallelaccess to 16 memory locations and supports up to 16 tables per tableset.

These look up tables are accessed with independently specified base andindex addresses. A look up table base address register (LTBR) specifiesthe base address for each set of parallel tables. Each look up tableinstruction contains a set number identifying which base addressregister to use for that instruction. Based upon the use of a directlyaddressable portion of the level one data cache 123, each base addressshould align with the cache line size of the level one data cache 123.In one embodiment, the cache line size may be 128 bytes.

A look up table configuration register for each set of parallel tablessets controls information to the corresponding set of tables. FIG. 19illustrates the data fields of an example look up table configurationregister 1900. Promotion field 1901 (bits 24 and 25) sets the type ofpromotion upon storage of elements into a vector register. Promotionfield 1901 is decoded as shown in Table 4.

TABLE 4 PROMOTION Description 00 No promotion 01 2x Promotion 10 4xPromotion 11 8x Promotion

A field 1901 coding of 00 designates no promotion. A field 1901 codingof 01 designates a 2× promotion. A field 1901 coding of 10 designates a4× promotion. A field 1901 coding of 11 designates an 8× promotion. Inone example embodiment, the promoted data is limited to data sizes up toa double-word size (64 bits). Thus, in such an embodiment: a 2×promotion is valid for a data element size of byte (promoted from byte(8 bits) to half word (16 bits), half word (promoted from half word (16bits) to word (32 bits), and word (promoted from word (32 bits) todouble-word (64 bits); a 4× promotion is valid for a data element sizeof byte (promoted from byte (8 bit) to word (32 bit) and half word(promoted from half word (16 bit) to double-word (64 bit); and an 8×promotion is only valid for a data element size of byte (promoted frombyte (8 bit) to double-word (64 bit). Promotion will be furtherexplained below.

Table size field 1902 (bits 16 to 23) sets the table size. Table Sizefield 1902 is decoded as shown in Table 5.

TABLE 5 Table Size Size 0000 0000 0.0 Kbytes 0000 0001 1.0 Kbytes 00000010 2.0 Kbytes 0000 0011 4.0 Kbytes 0000 0100 8.0 Kbytes 0000 0101 16.0Kbytes  0000 0110 32.0 Kbytes  0000 0111-1111 1111 Reserved

The table base address stored in the corresponding look up table baseaddress register must be aligned to the table size specified in the lookup table configuration register.

Weight Size (WSIZE) field 1903 (bits 11 to 13) indicates the size ofweight values in a source register for weighted histogram operations,described in further detail below. Weight Size field 1903 is decoded asshown in Table 6.

TABLE 6 WEIGHT SIZE Description 000 Byte/8 bits 001 Half word/16 bits010-111 Reserved

Interpolation field 1904 (bits 8 to 10) indicates a number of successiveelements written to a destination register in response to a look uptable read instruction, described in further detail below. Interpolationfield 1904 is decoded as shown in Table 7.

TABLE 7 Interpolation Description 000 No interpolation, only indexedelement per table is written 001 Returns 2 elements per table 010Returns 4 elements per table 011 Returns 8 elements per table 100-111Reserved

An interpolation field 1904 coding of 000 designates no interpolation,where only the indexed element per table is written from the look uptable to a destination register. An interpolation field 1904 coding of001 designates interpolating 2 elements, where the indexed element andan additional, adjacent element per table are written from the look uptable into the destination register. An interpolation field 1904 codingof 010 designates interpolating 4 elements, where the indexed elementand an additional, adjacent 3 elements per table are written from thelook up table into the destination register. An interpolation field 1904coding of 011 designates interpolating 8 elements, where the indexedelement and an additional, adjacent 7 elements per table are writtenfrom the look up table into the destination register. In one exampleembodiment, the interpolation field 1904 (in conjunction with the numberof tables field 1908, explained below) cannot exceed the maximum numberof elements that can be returned by L1D 123, which in one example is 16elements. Thus, in such an embodiment, no interpolation is possible whenthe number of tables field 1908 indicates 16 tables; a maximum of2-element interpolation is possible when the number of tables field 1908indicates 8 tables; a maximum of 4-element interpolation is possiblewhen the number of tables field 1908 indicates 4 tables; and a maximumof 8-element interpolation is possible when the number of tables field1908 indicates 2 tables or 1 table.

Saturation (SAT) field 1905 (bit 7) indicates whether to saturatehistogram bin entries to min/max values in response to a histogramoperation, described in further detail below. If the saturation field1905 is 1, then histogram bin entries are saturated to min/max values ofthe element data type. For example, unsigned bytes saturate to [0,0xFF]; signed bytes saturate to [0x80, 0x7F]; unsigned half-wordssaturate to [0, 0xFFFF]; signed half-words saturate to [0x8000, 0x7FFF];unsigned words saturate to [0, 0xFFFF FFFF]; and signed words saturateto [0x8000 0000, 0x7FFF FFFF]. If the saturation field 1905 is 0, thenhistogram bin entries do not saturate to min/max values of the elementdata type and instead will wrap around when incremented or decrementedbeyond a minimum value or maximum value, respectively.

Signed field 1906 (bit 6) indicates whether processor 100 treats therecalled look up table elements as signed integers or unsigned integers.If the signed field 1906 is 1, processor 100 treats the look up tableelements as signed integers. If the signed field 1906 is 0, processor100 treats the look up table elements as unsigned integers.

Element Size (ESIZE) field 1907 (bits 3 to 5) indicate the look up tableelement size. Element Size field 1907 is decoded as shown in Table 8.

TABLE 8 ELEMENT SIZE Description 000 byte/8 bits 001 half word/16 bits010 word/32 bits 011-111 reserved

Number of Tables (NTBL) field 1908 (bits 0 to 2) indicates the number oftables to be looked up in parallel. Number of Tables field 1908 isdecoded as shown in Table 9.

TABLE 9 NUMBER OF TABLES Description 000 1 table  001 2 tables 010 4tables 011 8 tables 100 16 tables  101-111 reserved

A look up table enable register 2000 specifies the type of operationspermitted for a particular table set. This is illustrated in FIG. 20 .As shown in FIG. 20 , this example employs a field in a single registerto control a corresponding one of the four table sets. Field 2001controls table set 3. Field 2002 controls table set 2. Field 2003controls table set 1. Field 2004 controls table set 0. Table Enablefields 2001, 2002, 2003 and 2004 are each decoded as shown in Table 10.

TABLE 10 TABLE ENABLE Description 00 no look up table operations 01 readoperations allowed 10 reserved 11 read and write operations allowed

If the table set field is 01, then read operations are permitted fromthe corresponding look up table base address register and thecorresponding look up table configuration register. If the table setfield is 11, then read operations are permitted from and writeoperations are permitted to the corresponding look up table base addressregister and the corresponding look up table configuration register. Ifthe table set field is 00, then no look up table operations arepermitted.

Each look up table instruction specifies a vector register as anoperand. This vector register is treated as a set of 32-bit look uptable indices by the look up table operation corresponding to theinstruction. Table 11 shows the coding of the vector indices in thevector operand register based upon the number tables for the set oftables controlled by Number of Tables field 1908 of the correspondinglook up table configuration register.

TABLE 11 Vector Register bits Index 1 table 2 tables 4 tables 8 tables16 tables Vx[31:0] index0 valid valid valid valid valid Vx[63:32] index1— valid valid valid valid Vx[95:64] index2 — — valid valid validVx[127:96] index3 — — valid valid valid Vx[159:128] index4 — — — validvalid Vx[191:160] index5 — — — valid valid Vx[223:192] index6 — — —valid valid Vx[255:224] index7 — — — valid valid Vx[287:256] index8 — —— — valid Vx[319:288] index9 — — — — valid Vx[351:320] index10 — — — —valid Vx[383:352] index11 — — — — valid Vx[415:384] index12 — — — —valid Vx[447:416] index13 — — — — valid Vx[479:448] index14 — — — —valid Vx[511:480] index15 — — — — valid

Depending upon the number of tables specified in the Number of Tablesfield 1908 of the corresponding look up table configuration register1900, the vector register bits specify various indices. The address fora table element within the first table for look up table operation isthe base address stored in the base address register plus the indexspecified by bits 0 to 31 of the vector register values. The address fora table element within the second table for look up table operation(assuming at least two tables are specified by number of tables field1908) is the base address stored in the base address register plus theindex specified by bits 32 to 63 of the vector register. Similarly, thevector register specifies an offset for each table specified.

FIG. 21 illustrates look up table organization when the correspondinglook up table configuration register 1900 specifies one table for thattable set. Level one data cache 123 includes a portion of directlyaddressable memory, including portion 2111 below the look up table, thelook up table, and a portion 2112 above the look up table. Thecorresponding look up table set base address register 2101 specifies thebeginning of the table set. In the example of FIG. 21 , the number oftables field 1908 specifies a single table. The end of the memoryallocated to the table set is specified by the table size field 1902.Index source register 2102 specifies a single offset (index iA) used toaddress the table. As shown in FIG. 21 , the single table employs all 16banks of memory.

FIG. 22 illustrates look up table organization when the correspondinglook up table configuration register 1900 specifies two tables for thattable set. The look up table set base address register 2101 specifiesthe beginning of the table set. The number of tables field 1908specifies two tables. The end of the memory allocated to the table setis specified by the table size field 1902. Index source register 2102specifies two offsets used to address the tables. A first index iAaddresses Table 1 and a second index iB addresses Table 2. Table 1 datais stored in memory banks 1 to 8. Table 2 data is stored in memory banks9 to 16.

FIG. 23 illustrates look up table organization when the correspondinglook up table configuration register 1900 specifies four tables for thattable set. The look up table set base address register 2101 specifiesthe beginning of the table set. The number of tables field 1908specifies four tables. The end of the memory allocated to the table setis specified by the table size field 1902. Index source register 2102specifies four offsets used to address the tables. A first index iAaddresses Table 1, a second index iB addresses Table 2, a third index iCaddresses Table 3 and a fourth index iD addresses Table 4. Table 1 datais stored in memory banks 1 to 4. Table 2 data is stored in memory banks5 to 8. Table 3 data is stored in memory banks 9 to 12. Table 4 data isstored in memory banks 13 to 16.

FIG. 24 illustrates look up table organization when the correspondinglook up table configuration register 1900 specifies eight tables forthat table set. The look up table set base address register 2101specifies the beginning of the table set. The number of tables field1908 specifies eight tables. The end of the memory allocated to thetable set is specified by the table size field 1902. Index sourceregister 2102 specifies a eight offsets used to address the tables. Afirst index iA addresses Table 1, a second index iB addresses Table 2, athird index iC addresses Table 3, a fourth index iD addresses Table 4, afifth index iE addresses Table 5, a sixth index iF addresses Table 6, aseventh index iG addresses Table 7, and an eighth index iH addressesTable 8. Table 1 data is stored in memory banks 1 and 2. Table 2 data isstored in memory banks 3 and 4. Table 3 data is stored in memory banks 5and 6. Table 4 data is stored in memory banks 7 and 8. Table 5 data isstored in memory banks 9 and 10. Table 6 data is stored in memory banks11 and 12. Table 7 data is stored in memory banks 13 and 14. Table 8data is stored in memory banks 15 and 16.

FIG. 25 illustrates look up table organization when the correspondinglook up table configuration register 1900 specifies sixteen tables forthat table set. The look up table set base address register 2101specifies the beginning of the table set. The number of tables field1908 specifies sixteen tables. The end of the memory allocated to thetable set is specified by the table size field 1902. Index sourceregister 2102 specifies sixteen offsets used to address the tables. Afirst index iA addresses Table 1, a second index iB addresses Table 2, athird index iC addresses Table 3, a fourth index iD addresses Table 4, afifth index iE addresses Table 5, a sixth index iF addresses Table 6, aseventh index iG addresses Table 7, an eighth index iH addresses Table8, a ninth index iI addresses Table 9, a tenth index iJ addresses Table10, an eleventh index iK addresses Table 11, a twelfth index iLaddresses Table 12, a thirteenth index iM addresses Table 13, afourteenth index iN addresses Table 14, a fifteenth index iO addressesTable 15, and a sixteenth index iP addresses Table 16. Table 1 data isstored in memory bank 1. Table 2 data is stored in memory bank 2. Table3 data is stored in memory bank 3. Table 4 data is stored in memory bank4. Table 5 data is stored in memory bank 5. Table 6 data is stored inmemory bank 6. Table 7 data is stored in memory bank 7. Table 8 data isstored in memory bank 8. Table 9 data is stored in memory bank 9. Table10 data is stored in memory bank 10. Table 11 data is stored in memorybank 11. Table 12 data is stored in memory bank 12. Table 13 data isstored in memory bank 13. Table 14 data is stored in memory bank 14.Table 15 data is stored in memory bank 15. Table 16 data is stored inmemory bank 16.

Below is the form of a look up table read (LUTRD) instruction inaccordance with one example embodiment.

-   -   LUTRD tbl_index, tbl_set, dst

Tbl_index is an instruction operand specifying a vector register (suchas within general vector register file 231) by register number. This isinterpreted as index numbers as shown in Table 11. Tbl_set is a number[0:3] specifying the table set employed in the instruction. This namedtable set number specifies: a corresponding look up table base addressregister storing the table base address, which may a scalar register ora vector register; a corresponding look up table configuration register(FIG. 19 ), which may a scalar register or a vector register; and thecorresponding operative portion of the look up table enable register(FIG. 20 ), which may a scalar register or a vector register. The lookup table base address register corresponding to the named table setdetermines the base address of the table set. The indices of the vectorregister named by Tbl_index are offset from this table set base address.The look up table configuration register corresponding to the namedtable set determines: the promotion mode (Table 4); the amount of memoryallocated to the table size (Table 5); the weight size for histogramoperations (Table 6); n-element interpolation for look up table readoperations (Table 7); whether values are to be treated as signed orunsigned; whether histogram bin entries are saturated to min/max values;the data element size (Table 8); and the number of tables in the tableset (Table 9). Dst is an instruction operand specifying a vectorregister (such as within general vector register file 231) by registernumber as the destination of the table look up operation. The datarecalled from the table as specified by these other parameters is packedand stored in this destination register. The process of promotion doesnot add any performance penalty.

FIG. 26 illustrates an example of the operation of the look up tableread instruction of this invention. In the example illustrated in FIG.26 , the corresponding look up table configuration register (1900)specifies four parallel tables, a data element size of byte (8 bits),and no promotion. To perform look up table operations, the look up tableenable register field (in register 2000) corresponding to the selectedtable set must enable either read operation (01) or both read and writeoperations (11).

The look up table base address register 2101 corresponding to thespecified table set stores the base address for the look up table set asillustrated schematically in FIG. 26 . The table data is stored in aportion of level one data cache 123 configured as directly accessiblememory, such as disclosed in U.S. Pat. No. 6,606,686 entitled UNIFIEDMEMORY SYSTEM ARCHITECTURE INCLUDING CACHE AND DIRECTLY ADDRESSABLESTATIC RANDOM ACCESS MEMORY.

The example illustrated in FIG. 26 has four tables: table 1 2611; table2 2612; table 3 2613; and table 4 2614. As shown in Table 11, thisinstruction with these selected options treats the data stored in vectorsource index register 2102 as a set of 4 32-bit fields specifying tableoffsets. The first field (bits Vx[31:0]) stores iA, the index into thefirst table 2611. In this example, this indexes to element A5. Thesecond field (bits Vx[63:32]) stores iB, the index into the second table2612. In this example, this indexes to element B1. The third field (bitsVx[95:64]) stores iC, the index into the third table 2613. In thisexample, this indexes to element C8. The fourth field (bits Vx[127:96])stores iD, the index into the fourth table 2614. In this example, thisindexes to element D10. The various indices are the memory addressoffsets from the base address for the table set to the specified dataelement. In accordance with the operation of this look up table readinstruction, the indexed data element in table 1 2611 (A5) is stored ina first data slot in destination register 2120. The indexed data elementin table 2 2612 (B1) is stored in a second data slot in destinationregister 2120. The indexed data element in table 3 2613 (C8) is storedin a third data slot in destination register 2120. The indexed dataelement in table 4 2614 (D10) is stored in a fourth data slot indestination register 2120. In accordance with this exampleimplementation, other data slots of destination register 2120 are zerofilled.

The look up table read instruction maps the data recalled from thetable(s) directly to vector lanes of destination register 2120. Theinstruction maps earlier elements to lower lane numbers and laterelements to higher lane numbers. The look up table read instructiondeposits elements in vectors in increasing-lane order. The look up tableread instruction fills each vector lane of destination register 2120with elements recalled from the table(s). If the recalled data does notequal the vector length, the look up table read instruction pads theexcess lanes of destination register 2120 with zeros.

When a promotion mode is enabled (promotion field 1901 of thecorresponding look up table configuration register 1900≠00), the look uptable read instruction promotes each recalled data element to a largersize. FIG. 27 illustrates an example of the operation of the look uptable read instruction in accordance with an example embodiment. FIG. 27illustrates an operation similar to FIG. 26 except that a 2× promotionis enabled (promotion field 1901 is 01). As in FIG. 26 , each of thefour indices of vector source index register 2102 recalls a data elementfrom a corresponding table. FIG. 27 illustrates these are placed indestination register 2120 differently than in FIG. 26 . Each recalleddata element is stored in a slot in destination register 2120 togetherwith an equally sized extension. This extension is formed correspondingto the signed/unsigned indication of signed field 1906 of thecorresponding look up table configuration register. If signed field 1906indicates unsigned (0), then the extension is zero filled. If signedfield 1906 indicates signed (1), then the extension slot is filled withthe same value as the most significant bit (sign bit) of thecorresponding data element. This treats the data element as a signedinteger.

FIG. 28 illustrates an example of the operation of the look up tableread instruction in accordance with an example embodiment. FIG. 28illustrates an operation similar to FIG. 26 except that a 4× promotionis enabled (promotion field 1901 is 10). Each of four indices of vectorsource index register 2102 recalls a data element from each table. FIG.28 illustrates these are placed in destination register 2120 differentlythan in FIG. 26 . Each recalled data element is stored in a slot indestination register 2120 together with three equally sized extensions.These extensions are formed corresponding to the signed/unsignedindication of signed field 1906 of the corresponding look up tableconfiguration register.

Those skilled in the art would understand that other data element sizes(e.g., half word, word) would be similarly implemented. Further, otherpromotion factors, such as a promotion factor of 8×, would be similarlyachieved. Those skilled in the art would understand how to apply theprinciples described in this disclosure to other numbers of look uptables within the selected set of tables.

FIGS. 29A and 29B together illustrate an example embodiment ofimplementation of promotion. Temporary register 2950 receives table datarecalled from level one data cache 123. Temporary register 2950 includes16 bytes arranged in 16 1-byte blocks lane 1 to lane 16. Note that theselanes are each equal in length to the minimum of data size specifiablein element size field 1907. In this example that is 1 byte/8 bits.Extension elements 2901 to 2908 form the extensions to respective lanes1 to 8. A plurality of multiplexers 2932 to 2946 couple input lanes fromtemporary register 2950 to corresponding lanes of destination register2120. Not all input lanes of temporary register 2950 are coupled toevery multiplexer 2932 to 2946. Many multiplexers 2932 to 2946 alsoreceive an extension input and one or more extension elements 2901 to2908. Note there is no multiplexer supplying lane 1 of output register2120. Lane 1 of destination register 2120 is always supplied by lane 1of temporary register 2950 in this illustrated embodiment.

FIG. 30 illustrates an exemplary extension element N of FIG. 29A. Thesign bit (S) of data element N of temporary register 2950 supplies oneinput of a corresponding extension multiplexer 3001. The sign bit of asigned integer is the most significant bit of the value as shown in FIG.30 . A constant 0 supplies a second input of multiplexer 3001.Multiplexer 3001 and other similar multiplexers corresponding to otherinput data elements are controlled by a signed/unsigned signal. Thissigned/unsigned signal based upon signed field 1906 of the correspondinglook up table configuration register 1900. If signed field 1906 is 0,then multiplexer 3001 (and the corresponding multiplexers for otherinput lanes) selects the constant 0 input. If signed field 1906 is 1,then multiplexer 3001 (and the corresponding multiplexers for otherinput lanes) selects the sign bit input. The selected extension issupplied to expansion element 3002. Expansion element 3002 expands thebit selected by multiplexer 3001 to the lane size. In accordance withthis example, the lane size is selected to equal the minimum table dataelement size of 1 byte. For a specified table data size equal to thelane size and in which the signed field 1906 is 0, the next data slot isfilled with 0's effecting a zero extension. If signed field 1906 is 1,the next data slot is filled with the sign bit of the data elementeffecting a sign extension. Multiplexers 2932 to 2946 select the properextension corresponding to the specified table data element size. If theselected table data element size is half word, multiplexers 2932 to 2946are controlled to select the extension from alternating extensionelements. If the selected table data element size is word, multiplexers2932 to 2946 are controlled to select the extension from every fourthextension element.

Multiplexers 2932 to 2946 are controlled by multiplexer control encoder3110 illustrated in FIG. 31 . Multiplexer control encoder 3110 receivesan element data size input (element size field 1907), a promoteindication (promotion field 1901) and generates corresponding controlsignals for multiplexers 2932 to 2946. Not all input bytes can supplyeach output byte. Table 12 illustrates this control. Table 12 shows thesource data for each of the 16 lanes of destination register 2120 forthe various data sizes and promotion modes in accordance with an exampleembodiment.

TABLE 12 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 --1x 16 15 14 13  12 11 10  9 8 7 6 5 4 3 2 1 b-2x e8 8 e7 7 e6 6 e5 5 e4 4 e3 3 e2 2 e1 1 b-4xe4 e4 e4 4 e3 e3 e3 3 e2 e2 e2 2 e1 e1 e1 1 b-8x e2 e2 e2 e2 e2 e2 e2 2e1 e1 e1 e1 e1 e1 e1 1 hw-2x e8 e8  8 7 e6 e6 6 5 e4 e4 4 3 e2 e2 2 1hw-4x e4 e4 e4 e4 e4 e4 4 3 e2 e2 e2 e2 e2 e2 2 1 w-2x e8 e8 e8 e8  8 76 5 e4 e4 e4 e4 4 3 2 1

Note that lane 1 of destination register 2120 is always the same as lane1 of temporary register 2950 regardless of selected data size orpromotion factor. The column devoted to lane 1 includes all 1's and FIG.29A illustrates a straight connection between lane 1 of temporaryregister 2950 and destination register 2120. The first row of Table 12shows that for no promotion (1×), each lane of destination register 2120is the same as temporary register 2950 regardless of the selected tabledata element data size. For a data size of byte and a promotion factorof 2 (b−2×), multiplexer 2932 selects the extension of lane 1 (e1),multiplexer 2933 selects the data of input lane 2, multiplexer 2934selects the extension of lane 2 (e2), multiplexer 2935 selects the dataof input lane 3, multiplexer 2936 selects the extension of lane 3 (e3),etc. For a data size of byte and a promotion factor of 4 (b−4×),multiplexers 2932 to 2934 select the extension of lane 1 (e1),multiplexer 2935 selects the data of input lane 2 and multiplexers 2936to 2938 select the extension of lane 2 (e2), multiplexer 2939 selectsthe data of input lane 3, multiplexers 2940 to 2942 select the extensionof lane 3 (e3), etc. For a data size of byte and a promotion factor of 8(b−8×), multiplexers 2932 to 2938 select the extension of lane 1 (e1),multiplexer 2939 selects the data of input lane 2, and multiplexers 2940to 2446 select the extension of lane 2 (e2). For a data size of halfword and a promotion factor of 2 (hw−2×), multiplexer 2932 selects thedata of lane 2, multiplexers 2933 and 2934 select the extension of lane2 (e2), multiplexer 2935 selects the data of lane 3, multiplexer 2936selects the data of lane 4, multiplexers 2937 and 2938 select theextension of lane 4 (e4), etc. For a data size of half word and apromotion factor of 4 (hw−4×), multiplexer 2932 selects the data of lane2, multiplexers 2933 to 2938 select the extension of lane 2 (e2),multiplexer 2939 selects the data of lane 3, multiplexer 2940 selectsthe data of lane 4, and multiplexers 2941 and 2946 select the extensionof lane 4 (e4). For a data size of word and a promotion factor of 2(w−2×), multiplexer 2932 selects data of lane 2, multiplexer 2933selects data of lane 3, multiplexer 2934 selects data of lane 4,multiplexers 2935 to 2938 select the extension of lane 4 (e4),multiplexer 2939 selects the data of lane 5, multiplexer 2940 selectsthe data of lane 6, multiplexer 2941 selects the data of lane 7,multiplexer 2942 selects the data of lane 8 and multiplexers 2943 to2946 select the extension of lane 8. As previously described, these areall the combinations of data size and promotion factor supported in thepresent example.

FIG. 32 illustrates another example of the operation of the look uptable read instruction of this disclosure. In the example illustrated inFIG. 32 , the corresponding look up table configuration register (1900)specifies four parallel tables, a data element size of word (32 bits),and 2-element interpolation. To perform look up table operations, thelook up table enable register field (in register 2000) corresponding tothe selected table set must enable either read operation (01) or bothread and write operations (11).

As above, the look up table base address register 2101 corresponding tothe specified table set stores the base address for the look up tableset as illustrated schematically in FIG. 32 . The table data is storedin a portion of level one data cache 123 configured as directlyaccessible memory.

The example illustrated in FIG. 32 has four tables: table 1 2611; table2 2612; table 3 2613; and table 4 2614. As shown in Table 11, thisinstruction with these selected options treats the data stored in vectorsource index register 2102 as a set of 4 32-bit fields specifying tableoffsets. The first field (bits Vx[31:0]) stores iA, the index into thefirst table 2611. In this example, this indexes to element A5. Thesecond field (bits Vx[63:32]) stores iB, the index into the second table2612. In this example, this indexes to element B1. The third field (bitsVx[95:64]) stores iC, the index into the third table 2613. In thisexample, this indexes to element C8. The fourth field (bits Vx[127:96])stores iD, the index into the fourth table 2614. In this example, thisindexes to element D10. The various indices are the memory addressoffsets from the base address for the table set to the specified dataelement.

When an interpolation mode is enabled (interpolation field 1904 of thecorresponding look up table configuration register 1900 #00), the lookup table read instruction returns one or more additional data elementsthan the indexed element per table. FIG. 32 illustrates an example ofthe operation of the look up table read instruction in accordance withan example embodiment. FIG. 32 illustrates an operation similar to FIG.26 , described above, except that a 2-element interpolation is enabled(interpolation field 1904 is 001). As in FIG. 26 , each of the fourindices of vector source index register 2102 recalls a data element froma corresponding table. FIG. 32 illustrates these are placed indestination register 2120 differently than in FIG. 26 . In particular, 2data elements are returned for each of the four indices: the dataelement recalled by a particular index and the next adjacent dataelement (regardless of row boundaries). For example, if the data elementrecalled by a particular index is A0, then the next adjacent dataelement is A1; if the data element recalled by a particular index is A7,then the next adjacent data element is A8 although A8 is on a differentrow.

Each recalled data element is stored in a slot in destination register2120. In accordance with the operation of this look up table readinstruction where 2-element interpolation is enabled, the indexed dataelement in table 1 2611 (A5) and its next adjacent data element (A6) arestored in first and second data slots in destination register 2120. Theindexed data element in table 2 2612 (B1) and its next adjacent dataelement (B2) are stored in third and fourth data slots in destinationregister 2120. The indexed data element in table 3 2613 (C8) and itsnext adjacent data element (C9) are stored in fifth and sixth data slotsin destination register 2120. The indexed data element in table 4 2614(D10) and its next adjacent data element (D11) are stored in a seventhand eighth data slots in destination register 2120. In accordance withthis example implementation, other data slots of destination register2120 are zero filled.

FIG. 33 illustrates an example of the operation of the look up tableread instruction in accordance with an example embodiment. FIG. 33illustrates an operation similar to FIG. 32 except that a 4-elementinterpolation is enabled (interpolation field 1904 is 010). As in FIG.32 , each of four indices of vector source index register 2102 recalls adata element from each table. FIG. 33 illustrates these are placed indestination register 2120 differently than in FIG. 32 . In particular, 4data elements are returned for each of the four indices: the dataelement recalled by a particular index and the next 3 adjacent dataelements (regardless of row boundaries). For example, if the dataelement recalled by a particular index is A0, then the next 3 adjacentdata elements are A1-A3; if the data element recalled by a particularindex is A7, then the next 3 adjacent data elements are A8-A10, althoughA8-A10 are on a different row.

Each recalled data element is stored in a slot in destination register2120. In accordance with the operation of this look up table readinstruction where 4-element interpolation is enabled, the indexed dataelement in table 1 2611 (A5) and its next 3 adjacent data elements(A6-A8) are stored in the first 4 data slots in destination register2120. The indexed data element in table 2 2612 (B1) and its next 3adjacent data elements (B2-B4) are stored in the second 4 data slots indestination register 2120. The indexed data element in table 3 2613 (C8)and its next 3 adjacent data elements (C9-C11) are stored in the third 4data slots in destination register 2120. The indexed data element intable 4 2614 (D10) and its next 3 adjacent data elements (D11-D13) arestored in the fourth 4 data slots in destination register 2120. In thisexample, where the data element size is word, the 16 recalled dataelements completely fill the destination register 2120; however, in anotherwise-similar example where the data element size is insteadhalf-word or byte, the 16 recalled data elements would not completelyfill the destination register 2120 and the remainder of data slots ofdestination register 2120 are zero filled.

Those skilled in the art would understand how to apply the principlesdescribed in this disclosure to other numbers of look up tables withinthe selected set of tables. For example, 8-element interpolation is notpossible when the number of tables is 4 and the tables are arranged inlevel one data cache 123 in the manner shown in FIG. 33 , since only oneelement per memory bank is accessible at a time. However, 8-elementinterpolation is possible when the number of tables is 2 or 1.

FIG. 34 illustrates an example embodiment of implementation ofinterpolation, discussed above. In the example of FIG. 34 , anintermediate register 3402 receives table data recalled from level onedata cache 123. In this example, the level one data cache 123 thatcontains the tables 2611, 2612, 2613, 2614 is configured to provide aword of data from each of its 16 banks (described above) regardless ofthe data requested by a look up read instruction. The data provided tothe intermediate register 3402 is ordered as it appears in the 16 banksof the level one data cache 123, regardless of interpolation or othervariables specified by the look up table configuration register 1900.

Continuing the example of FIG. 33 , in which the look up table readinstruction includes 4-element interpolation, the intermediate register3402 contains each of the four indexed data elements (e.g., A5, B1, C8,D10) and the next 3 adjacent data elements from each of the indexed dataelements. However, as explained above, the intermediate register 3402contains these data elements ordered as they appear in the 16 banks ofthe level one data cache 123, and thus not necessarily in numericalorder of the data elements as shown in the destination register 2120 inFIG. 33 above.

For example, the four elements from Table 1 2611 (A5-A8) appear in theorder A8, A5, A6, A7, since this is the order in which those elementsappear in the first four banks of the level one data cache 123. On theother hand, the four elements from Table 3 2613 (C8-C11) appear in orderin the intermediate register 3402 since the element C8 is already in thelowest bank of the level one data cache 123 corresponding to Table 32613.

In order to facilitate proper ordering of data elements written to thedestination register 2120, explained above with respect to FIG. 33 ,examples of this disclosure include a multi-stage butterfly unit 3404,which receives the intermediate register 3402 as an input and producesan output that is written to the destination register 2120. Thebutterfly unit 3404 is configured to reorder the bits of theintermediate register 3402 according to various control signals. Thesecontrol signals include, but are not necessarily limited to, all or aportion of the addresses that correspond to the indexed data elements ineach of the tables 2611, 2612, 2613, 2614. For example, decoding theindices 3401 (or portions of the addresses of the indexed data elements)indicates the position of an indexed data element within a table andthus whether reordering may be necessary. In the present example, anaddress of the indexed data element A5 indicates A5 is not aligned withthe lowest bank of the level one data cache 123 corresponding to Table 12611, and thus the bits of the intermediate register 3402 correspondingto Table 1 2611 should be reordered. On the other hand, an address ofthe indexed data element C8 indicates C8 is aligned with the lowest bankof the level one data cache 123 corresponding to Table 3 2613, and thusthe bits of the intermediate register 3402 corresponding to Table 3 2613need not be reordered.

To further facilitate proper ordering of data elements written to thedestination register 2120, the multi-stage butterfly unit 3404 alsoreceives all or portions of the look up table configuration register1900 as control signal(s). In particular, the interpolation field 1904,the element size field 1907, and the number of tables field 1908 mayinfluence the function of the multi-stage butterfly unit 3404. WhileFIG. 34 is meant to illustrate how the butterfly unit 3404 processes aset of data elements from the look up tables 2611, 2612, 2613, 2614 inaccordance with the example shown in in FIG. 34 , the butterfly unit3404 can process the data elements in accordance with a number ofdifferent possible settings in the look up table configuration register1900. Additional examples of the butterfly unit 3404 functionality areprovided below.

In a first example, the control signals from the look up tableconfiguration register 1900 provided to the multi-stage butterflynetwork 3404 include the element size field 1907 indicating a size ofword, the interpolation field 1904 indicating no interpolation, and thenumber of tables field 1908 indicating two tables. In this example, themulti-stage butterfly network 3404 receives one indexed element fromeach group of banks 1-8 and banks 9-16 of the level one data cache 123,for example according to the two-table embodiment shown in FIG. 22 .Thus, in response to these control signals from the look up tableconfiguration register 1900, the multi-stage butterfly network 3404places the indexed elements from each group of banks 1-8 and banks 9-16in the first two word-size lanes of the destination register 2120,respectively. In one example, the remaining lanes of the destinationregister 2120 are zero-filled, while in other examples the remaininglanes of the destination register may be filled in different manners.

In a second example, the control signals from the look up tableconfiguration register 1900 provided to the multi-stage butterflynetwork 3404 include the element size field 1907 indicating a size ofword, the interpolation field 1904 indicating 2-element interpolation,and the number of tables field 1908 indicating two tables. In thisexample, the multi-stage butterfly network 3404 receives one indexedelement and a next adjacent element (e.g., according to 2-elementinterpolation, explained above) from each group of banks 1-8 and banks9-16 of the level one data cache 123. Thus, in response to these controlsignals from the look up table configuration register 1900, themulti-stage butterfly network 3404 places the indexed element and thenext adjacent element from the group of banks 1-8 in order in the firsttwo word-size lanes of the destination register 2120. Similarly, themulti-stage butterfly network 3404 places the indexed element and thenext adjacent element from the group of banks 9-16 in order in thesecond two word-size lanes of the destination register 2120. In oneexample, the remaining lanes of the destination register 2120 arezero-filled, while in other examples the remaining lanes of thedestination register may be filled in different manners.

In a third example, the control signals from the look up tableconfiguration register 1900 provided to the multi-stage butterflynetwork 3404 include the element size field 1907 indicating a size ofword, the interpolation field 1904 indicating 8-element interpolation,and the number of tables field 1908 indicating two tables. In thisexample, the multi-stage butterfly network 3404 receives one indexedelement and a next 7 adjacent elements (e.g., according to 8-elementinterpolation) from each group of banks 1-8 and banks 9-16 of the levelone data cache 123. As explained above, the next 7 adjacent elements maywrap into a subsequent row. Thus, in response to these control signalsfrom the look up table configuration register 1900, the multi-stagebutterfly network 3404 places the indexed element and the next 7adjacent elements from the group of banks 1-8 in order in the firsteight word-size lanes of the destination register 2120. Similarly, themulti-stage butterfly network 3404 places the indexed element and thenext 7 adjacent elements from the group of banks 9-16 in order in thesecond eight word-size lanes of the destination register 2120. In thisexample, assuming a 512-bit destination register 2120, all lanes arefilled by the read operation and thus no additional filling is required.

Extensions of the above-described functionality of the multi-stagebutterfly network 3404 in response to different combinations of controlsignals from the look up table configuration register 1900 should beapparent to one of ordinary skill in the art. For example, changes tothe number of tables field 1908 affects the “boundaries” on whichelements may be reordered before writing to the destination register2120 (e.g., the number of tables field 1908 indicating four tablesresults in “boundaries” between groups of banks 1-4, 5-8, 9-12, and13-16, while the number of tables field 1908 indicating eight tablesresults in “boundaries” between groups of banks 1-2, 3-4, 5-6, 7-8,9-10, 11-12, 13-14, and 15-16). As another example, changes to theelement size field 1907 affect how bits from the intermediate register3402 are packed into the destination register 2120.

Below is the form of a look up table write (LUTWR) instruction inaccordance with one example embodiment.

-   -   LUTWR tbl_index, tbl_set, write_data

Tbl_index is an instruction operand specifying a vector register (suchas within general vector register file 231) by register number. This isinterpreted as index numbers as shown in Table 11, above. Tbl_set is anumber [0:3] specifying the table set employed in the instruction. Thisnamed table set number specifies: a corresponding look up table baseaddress register storing the table base address, which may be a scalarregister or a vector register; a corresponding look up tableconfiguration register (FIG. 19 ), which may a scalar register or avector register; and the corresponding operative portion of the look uptable enable register (FIG. 20 ), which may a scalar register or avector register. The look up table base address register correspondingto the named table set determines the base address of the table set. Theindices of the vector register named by Tbl_index are offset from thistable set base address. The look up table configuration registercorresponding to the named table set determines: the promotion mode(Table 4); the amount of memory allocated to the table size (Table 5);the weight size for histogram operations (Table 6); n-elementinterpolation for look up table read operations (Table 7); whethervalues are to be treated as signed or unsigned; whether histogram binentries are saturated to min/max values; the data element size (Table8); and the number of tables in the table set (Table 9). Write_data isan instruction operand, specifically a source operand, specifying avector register (such as within general vector register file 231) byregister number to provide source data to be written to the look uptables. As above, the number of tables, size of the elements, and otherparameters are specified in the look up table configuration register1900.

FIG. 35 illustrates an example of the operation of the look up tablewrite instruction of this disclosure. In the example illustrated in FIG.35 , the corresponding look up table configuration register (1900)specifies four parallel tables and a data element size of word (32bits). To perform look up table operations, the look up table enableregister field (in register 2000) corresponding to the selected tableset must enable both read and write operations (11).

As above, the look up table base address register 2101 corresponding tothe specified table set stores the base address for the look up tableset as illustrated schematically in FIG. 35 . The table data is storedin a portion of level one data cache 123 configured as directlyaccessible memory.

The example illustrated in FIG. 35 has four tables: table 1 2611; table2 2612; table 3 2613; and table 4 2614. As shown in Table 11, thisinstruction with these selected options treats the data stored in vectorsource index register 2102 as a set of 4 32-bit fields specifying tableoffsets. The first field (bits Vx[31:0]) stores iA, the index into thefirst table 2611. In this example, this indexes to element A5 (e.g.,between A4 and A6). The second field (bits Vx[63:32]) stores iB, theindex into the second table 2612. In this example, this indexes toelement B1 (e.g., between B0 and B2). The third field (bits Vx[95:64])stores iC, the index into the third table 2613. In this example, thisindexes to element C8 (e.g., between C7 and C9). The fourth field (bitsVx[127:96]) stores iD, the index into the fourth table 2614. In thisexample, this indexes to element D10 (e.g., between D9 and D11). Thevarious indices are the memory address offsets from the base address forthe table set to the specified data element to be written.

A vector source data register 3502 contains data to be written to theindexed data elements of the look up tables 2611, 2612, 2613, 2614. Inthis example, because the look up table configuration register specifiesa number of tables of four and an element size of word, the first fourwords of the vector source data register 3502 are utilized by the lookup table write instruction, while the remainder of the vector sourcedata register 3502 is not utilized by the look up table writeinstruction. In particular, the first word (W1) is written to theelement specified by the index iA, or A5; the second word (W2) iswritten to the element specified by the index iB, or B1; the third word(W3) is written to the element specified by the index iC, or C8; and thefourth word (W4) is written to the element specified by the index iD, orD10.

Extensions of the above-described look up table write instruction inresponse to different parameters specified by the look up tableconfiguration register 1900 should be apparent to one of ordinary skillin the art. For example, changes to the number of tables field 1908affects the number of indexes specified by the vector source indexregister 2102 (e.g., as shown in FIGS. 21-25 ). Similarly, changes tothe element size field 1907 affects the portion of the vector sourcedata register 3502 that provides source data to be written to theindexed data elements of the look up tables.

Below is the form of a look up table initialization (LUTINIT)instruction in accordance with one example embodiment.

-   -   LUTINIT tbl_index, tbl_set, write_data

Tbl_index, tbl_set, and write_data are generally similar to thosedescribed above with respect to the look up table write instruction. Asabove, the number of tables, size of the elements, and other parametersare specified in the look up table configuration register 1900. Unlikethe look up table write instruction, which writes source data only to anindexed element in each table (tables 2611, 2612, 2613, 2614 in theexample of FIG. 35 ), the look up table initialization instructionduplicates source data to more efficiently write to larger portions ofthe look up tables. As suggested by the instruction name, suchduplication of source data is particularly useful when initializingelements of look up tables to particular values.

The look up table initialization instruction specifies source data for asingle table (e.g., the vector source index register 2102 contains onlya single index, for example in the first field (bits Vx[31:0])). Thesource data specified by the vector source data register 3502 varies insize depending on the number of tables specified by the look up tableconfiguration register 1900. In response to execution of a look up tableinitialization instruction, the level one data cache 123 replicates thesource data internally, based on the number of tables specified by thelook up table configuration register 1900, and writes the resultingreplicated data to the location specified by the index value in thevector source index register 2102 and the look up table base addressregister 2101. The duplicated data is written to the location specifiedby the index value in the vector source index register 2102 along withcorresponding locations in each of the other tables in the table set.

FIGS. 36A and 36B show examples of the initialization of the level onedata cache 123 resulting from execution of exemplary look up tableinitialization instructions. In the example of FIG. 36A, the number oftables is 16 and the element size is word. The following are theexemplary look up table initialization instructions, the execution ofwhich results in the example population 3604 of the level one data cache123:

-   -   LUTINIT D0, 0, B0; where D0=0x00 (e.g., the index of the element        in row 0, level one data cache 123 bank 0), 0 is the specified        table set, B0=D[63:0]    -   LUTINIT D1, 0, B1; where D1=0x02 (e.g., the index of the element        in row 1, level one data cache 123 bank 0), 0 is the specified        table set, B1=D[127:64]    -   LUTINIT D2, 0, B2; where D2=0x04 (e.g., the index of the element        in row 2, level one data cache 123 bank 0), 0 is the specified        table set, B2=D[191:128]    -   LUTINIT D3, 0, B3; where D3=0x06 (e.g., the index of the element        in row 3, level one data cache 123 bank 0), 0 is the specified        table set, B3=D[255:192]        As explained above, the source data specified by the vector        source data register 3502 varies in size depending on the number        of tables specified by the look up table configuration register        1900. In this example, the level one data cache has a width of        1024 bits and there are 16 tables, and thus each table is 64        bits wide. The registers B0-B3 are scalar registers, also having        a size of 64 bits, and thus the entire contents of the registers        B0-B3 are utilized by the look up table initialization        instructions. In another example, the source data register is        the vector source data register 3502, and thus only a portion of        the contents of the register (e.g., the first 64 bits) is        utilized by the lookup table initialization instruction.

The first look up table initialization instruction results in 64 bits ofsource data from register B0 being written to each of the 16 tables inthe table set 0, beginning at the location specified by the index 0x00(plus a base address from the look up table configuration register1900), which is the first element in row 0. The second look up tableinitialization instruction results in 64 bits of source data fromregister B1 being written to each of the 16 tables in the table set 0,beginning at the location specified by the index 0x02 (plus the baseaddress from the look up table configuration register 1900), which isthe first element in row 1. The third look up table initializationinstruction results in 64 bits of source data from register B2 beingwritten to each of the 16 tables in the table set 0, beginning at thelocation specified by the index 0x04 (plus the base address from thelook up table configuration register 1900), which is the first elementin row 2. The fourth look up table initialization instruction results in64 bits of source data from register B3 being written to each of the 16tables in the table set 0, beginning at the location specified by theindex 0x06 (plus the base address from the look up table configurationregister 1900), which is the first element in row 3.

As will be explained further below, in the example of FIG. 36A, sincethere are 16 tables and the element size is word, there are two wordsper row per table. The permitted index values (e.g., in registers D0-D3)correspond to the first element of each row, and thus also increase bytwo (e.g., 0x00, 0x02, 0x04, 0x06, and so on). If the element size was,instead, half word, there would be four half words per row per table,and the permitted index values would increase by four (e.g., 0x00, 0x04,0x08, 0x0C, and so on). Similarly, if the element size was, instead,byte, there would be eight bytes per row per table, and the permittedindex values would increase by eight (e.g., 0x00, 0x08, 0x10, 0x18, andso on). This convention is reflected in the following Table 13, whichprovides an example of row addressing for each supported number oftables (“ways” in Table 13) and element size configuration. Such rowaddressing may be employed by successive look up table initializationinstructions to populate an entire look up table, with subsequentinitialization instructions specifying the index of the first element inthe row that is being populated.

TABLE 13 No of Ways Element type Index for LUTINT 16 word 0x0, 0x2, 0x4,0x6, 0x8, 0xA, 0xC, 0xE, . . . halfword 0x0, 0x4, 0x8, 0xC, 0x10, 0x14,0x18, 0x1C, . . . byte 0x0, 0x8, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38,0x40, . . . 8 word 0x0, 0x4, 0x8, 0xC, 0x10, 0x14, 0x18, 0x1C, . . .halfword 0x0, 0x8, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, . . . byte0x0, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, . . . 4 word 0x0,0x8, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, . . . halfword 0x0, 0x10,0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, . . . byte 0x0, 0x20, 0x40,0x60, 0x80, 0x0, 0xC0, 0xE0, 0x100, . . . 2 word 0x0, 0x10, 0x20, 0x30,0x40, 0x50, 0x60, 0x70, 0x80, . . . halfword 0x0, 0x20, 0x40, 0x60,0x80, 0x0, 0xC0, 0xE0, 0x100, . . . byte 0x0, 0x40, 0x80, 0xC0, 0x100,0x140, 0x180, 0x1C0, 0x200, 0x240, . . . 1 word 0x0, 0x10, 0x20, 0x30,0x40, 0x50, 0x60, 0x70, 0x80, . . . halfword 0x0, 0x20, 0x40, 0x60,0x80, 0x0, 0xC0, 0xE0, 0x100, . . . byte 0x0, 0x40, 0x80, 0xC0, 0x100,0x140, 0x180, 0x1C0, 0x200, 0x240, . . .

In the example of FIG. 36B, the number of tables is 1 and the elementsize is byte. The following are the exemplary look up tableinitialization instructions, the execution of which results in theexample population 3608 of the level one data cache 123:

-   -   LUTINIT D0, 0, VB0; where D0=0x00 (e.g., the index of the        element in row 0, level one data cache 123 bank 0), 0 is the        specified table set, VB3=DATA0[511:0]    -   LUTINIT D1, 0, VB1; where D1=0x40 (e.g., the index of the        element in row 0, level one data cache 123 bank 8), 0 is the        specified table set, VB1=DATA1[511:0]    -   LUTINIT D2, 0, VB2; where D2=0x80 (e.g., the index of the        element in row 1, level one data cache 123 bank 0), 0 is the        specified table set, VB2=DATA2[511:0]    -   LUTINIT D3, 0, VB3; where D3=0xC0 (e.g., the index of the        element in row 1, level one data cache 123 bank 8), 0 is the        specified table set, VB3=DATA3[511:0]        As explained above, the source data specified by the vector        source data register 3502 varies in size depending on the number        of tables specified by the look up table configuration register        1900. In this example, the level one data cache 123 has a width        of 1024 bits and there is one table, which has a maximum width        of one vector, or 512 bits, and thus each row of the level one        data cache 123 contains two rows of the table. Since there is        only one table, no duplication occurs. The registers VB0-VB3 are        vector registers, also having a size of 512 bits, and thus the        entire contents of the registers VB0-VB3 are utilized by the        look up table initialization instructions.

The first look up table initialization instruction results in 512 bitsof source data from register VB0 being written to the table in the tableset 0, at the location specified by the index 0x00 (plus a base addressfrom the look up table configuration register 1900), which is the firstelement in row 0. The second look up table initialization instructionresults in 512 bits of source data from register VB1 being written tothe table in the table set 0, at the location specified by the index0x40 (plus the base address from the look up table configurationregister 1900), which is the 65th element in row 0 (e.g., the firstelement in bank 8). The third look up table initialization instructionresults in 512 bits of source data from register VB2 being written tothe table in the table set 0, at the location specified by the index0x80 (plus the base address from the look up table configurationregister 1900), which is the first element in row 1. The fourth look uptable initialization instruction results in 512 bits of source data fromregister VB3 being written to the table in the table set 0, at thelocation specified by the index 0xC0 (plus the base address from thelook up table configuration register 1900), which is the 65th element inrow 1 (e.g., the first element in bank 8).

As explained, the level one data cache 123 has a bandwidth of 1024 bits,although the data bus (e.g., 144) between the central processing unitcore 110 and the level one data cache 123 is only 512 bits in theexample embodiment shown in FIG. 1 . Thus, 512 bits is the maximum sizeof write_data able to be provided to the level one data cache 123 (e.g.,from vector source data register 3502). Duplication is not supported inthe example where the number of tables is 1, since there is not anothertable into which to write duplicated source data. In an example, thelook up table initialization instruction when the number of tables is 1provides the same bandwidth as a look up table write instruction (or avector store), described above. However, for number of tables equal to2, 4, 8, or 16, the write_data from the vector source data register 3502is duplicated according to the following Table 14.

TABLE 14 Element Data Send Data Written to Expansion No of Ways type Out(bits) L1D SRAM (bits) Factor 16 word 64 1024 16 halfword 64 1024 16byte 64 1024 16 8 word 128 1024 8 halfword 128 1024 8 byte 128 1024 8 4word 256 1024 4 halfword 256 1024 4 byte 256 1024 4 2 word 512 1024 2halfword 512 1024 2 byte 512 1024 2 1 word 512 512 1 halfword 512 512 1byte 512 512 1

As demonstrated, depending on the number of tables specified by the lookup table configuration register 1900, the portion of the vector sourcedata register 3502 that is sent to the level one data cache 123 to beduplicated varies, for example from 64 bits when the number of tables is16 to 512 bits when the number of tables is 2 (duplication allowed) or 1(duplication not allowed). Further, as explained with respect to FIG.36A, in the example where there are 16 tables, resulting in a tablewidth of 64 bits, a scalar register may also contain the source data tobe written to the tables. However, in other examples a scalar registercannot be used as the source register since more than 64 bits are needed(e.g., for 8-, 4-, 2-, and 1-table examples).

Below is the form of a histogram (HIST) instruction and a weightedhistogram (WHIST) instruction in accordance with one example embodiment.

-   -   HIST hist_index, hist_set    -   WHIST hist_index, hist_set, hist_weights

Hist_index is an instruction operand specifying a vector register (suchas within general vector register file 231) by register number. This isinterpreted as index numbers as shown in Table 11, above. Hist_index issimilar to Tbl_index discussed above, but particularly for the histogramcontext rather than the look up table context. Similarly, Hist_set is anumber [0:3] specifying the histogram set employed in the instruction.This named histogram set number specifies: a corresponding look up table(or histogram) base address register storing the base address of the setof histograms, which may be a scalar register or a vector register; acorresponding look up table (or histogram) configuration register (FIG.19 ), which may be a scalar register or a vector register; and thecorresponding operative portion of the look up table (or histogram)enable register (FIG. 20 ), which may be a scalar register or a vectorregister. The base address register corresponding to the named histogramset determines the base address of the histogram set. The indices of thevector register named by Hist_index are offset from this table set baseaddress. The look up table configuration register corresponding to thenamed table set determines: the promotion mode (Table 4); the amount ofmemory allocated to the table size (Table 5); the weight size forhistogram operations (Table 6); n-element interpolation for look uptable read operations (Table 7); whether values are to be treated assigned or unsigned; whether histogram bin entries are saturated tomin/max values; the data element size (Table 8); and the number ofhistograms in the histogram set (Table 9). For weighted histogram(WHIST) instructions, hist_weights is an instruction operand specifyinga vector register (such as within general vector register file 231) byregister number to provide weights to increment addressed bin entries inthe histograms. Similar to above, the number of histograms, size of thebin entries, size of weights, whether saturation is employed, and otherparameters are specified in the configuration register 1900.

FIG. 37 illustrates an example of the operation of the histograminstruction of this disclosure. In the example illustrated in FIG. 37 ,the corresponding configuration register (1900) specifies four parallelhistograms 3711, 3712, 3713, 3714 and a data element size of word (32bits). To perform histogram operations, the enable register field (inregister 2000) corresponding to the selected histogram set should enableboth read and write operations (11).

As above, the base address register 2101 corresponding to the specifiedhistogram set stores the base address for the histogram set asillustrated schematically in FIG. 37 . The histogram data is stored in aportion of level one data cache 123 configured as directly accessiblememory.

The example illustrated in FIG. 37 has four histograms: hist 1 3711;hist 2 3712; hist 3 3713; and hist 4 3714. As shown in Table 11, thisinstruction with these selected options treats the data stored in vectorsource index register 2102 as a set of 4 32-bit fields specifying tableoffsets. The first field (bits Vx[31:0]) stores iA, the index into thefirst histogram 3711. In this example, this indexes to element A5 (e.g.,between A4 and A6). The second field (bits Vx[63:32]) stores iB, theindex into the second histogram 3712. In this example, this indexes toelement B1 (e.g., between B0 and B2). The third field (bits Vx[95:64])stores iC, the index into the third histogram 3713. In this example,this indexes to element C8 (e.g., between C7 and C9). The fourth field(bits Vx[127:96]) stores iD, the index into the fourth histogram 3714.In this example, this indexes to element D10 (e.g., between D9 and D11).The various indices are the memory address offsets from the base addressfor the histogram set to the specified bin element to be modified.

In response to execution of a histogram instruction according to theexample of FIG. 37 , the indexed bin entries specified by the baseaddress register 2101 and the vector source index register 2102 areincremented by a value of 1. The bin entry specified by iA (e.g., A5) isincremented by 1; the bin entry specified by iB (e.g., B1) isincremented by 1; the bin entry specified by iC (e.g., C8) isincremented by 1; and the bin entry specified by iD (e.g., D10) isincremented by 1.

If the saturation field 1905 of the configuration register 1900 is set,then bin entries are saturated (e.g., limited) to min/max values of theelement data type in response to the histogram operation. For example,unsigned bytes saturate to [0, 0xFF]; signed bytes saturate to [0x80,0x7F]; unsigned half-words saturate to [0, 0xFFFF]; signed half-wordssaturate to [0x8000, 0x7FFF]; unsigned words saturate to [0, 0xFFFFFFFF]; and signed words saturate to [0x8000 0000, 0x7FFF FFFF]. If thesaturation field 1905 is 0, then histogram bin entries do not saturateto min/max values of the element data type and instead will wrap aroundwhen incremented beyond a maximum value or decremented beyond a minimumvalue.

FIG. 38 illustrates an example of the operation of the weightedhistogram instruction of this disclosure. FIG. 38 is similar to FIG. 37, but includes the vector source data register 3502, explained above.The vector source data register 3502 is specified by hist_weights andincludes weights to increment addressed bin entries in the histograms3711, 3712, 3713, 3714.

Unlike above with respect to the look up table write instruction, forweighted histogram instructions, the vector source data register 3502contains data to be added to the indexed bin entries in the histograms3711, 3712, 3713, 3714. In some examples, histogram weights are signedvalues and weight size is limited to byte and half-word. Further, insome examples, weight size cannot be larger than the specified bin entrysize. Thus, for byte-size bins, only byte-size weights are permitted;for half-word or word-size bins, byte or half-word size weights arepermitted. In certain examples, for word-size bins, word size weightsare permitted as well. In this example, because the look up tableconfiguration register specifies a number of histograms of four and aweight size of half-word (which is permitted due to the bin entry sizebeing specified as word-size), the first four half-words of the vectorsource data register 3502 are utilized by the weighted histograminstruction, while the remainder of the vector source data register 3502is not utilized by the weighted histogram instruction. In particular,the first half-word (value of +5) is added to the bin entry specified bythe index iA (e.g., A5 is incremented by 5); the second half-word (valueof +2) is added to the bin entry specified by the index iB (e.g., B1 isincremented by 2); the third half-word (value of −3) is added to the binentry specified by the index iC (e.g., C8 is decremented by 3); and thefourth half-word (value of +7) is added to the bin entry specified bythe index iD (e.g., D10 is incremented by 7).

Similar to the above histogram instruction, if the saturation field 1905of the configuration register 1900 is set, then bin entries aresaturated (e.g., limited) to min/max values of the element data type inresponse to the histogram operation. For example, unsigned bytessaturate to [0, 0xFF]; signed bytes saturate to [0x80, 0x7F]; unsignedhalf-words saturate to [0, 0xFFFF]; signed half-words saturate to[0x8000, 0x7FFF]; unsigned words saturate to [0, 0xFFFF FFFF]; andsigned words saturate to [0x8000 0000, 0x7FFF FFFF]. If the saturationfield 1905 is 0, then histogram bin entries do not saturate to min/maxvalues of the element data type and instead will wrap around whenincremented beyond a maximum value or decremented beyond a minimumvalue.

Extensions of the above-described histogram and weighted histograminstructions in response to different parameters specified by theconfiguration register 1900 should be apparent to one of ordinary skillin the art. For example, changes to the number of tables (or histograms)field 1908 affects the number of indexes specified by the vector sourceindex register 2102 (e.g., as shown in FIGS. 21-25 ). Similarly, changesto the weight size field 1903 affects the portion of the vector sourcedata register 3502 that provides source data to be written to theindexed bin entries of the histograms.

In the foregoing discussion and in the claims, the terms “including” and“comprising” are used in an open-ended fashion, and thus should beinterpreted to mean “including, but not limited to . . . .” Also, theterm “couple” or “couples” is intended to mean either an indirect ordirect connection. Thus, if a first device couples to a second device,that connection may be through a direct connection or through anindirect connection via other devices and connections. Similarly, adevice that is coupled between a first component or location and asecond component or location may be through a direct connection orthrough an indirect connection via other devices and connections. Anelement or feature that is “configured to” perform a task or functionmay be configured (e.g., programmed or structurally designed) at a timeof manufacturing by a manufacturer to perform the function and/or may beconfigurable (or re-configurable) by a user after manufacturing toperform the function and/or other additional or alternative functions.The configuring may be through firmware and/or software programming ofthe device, through a construction and/or layout of hardware componentsand interconnections of the device, or a combination thereof.Additionally, uses of the phrases “ground” or similar in the foregoingdiscussion are intended to include a chassis ground, an Earth ground, afloating ground, a virtual ground, a digital ground, a common ground,and/or any other form of ground connection applicable to, or suitablefor, the teachings of the present disclosure. Unless otherwise stated,“about,” “approximately,” or “substantially” preceding a value means+/−10 percent of the stated value.

The above discussion is meant to be illustrative of the principles andvarious embodiments of the present disclosure. Numerous variations andmodifications will become apparent to those skilled in the art once theabove disclosure is fully appreciated. It is intended that the followingclaims be interpreted to embrace all such variations and modifications.

What is claimed is:
 1. A device comprising: a memory configured to storea set of tables; an intermediate register coupled to the memory; abutterfly network coupled to the intermediate register; a destinationregister coupled to the intermediate register; a processor functionalunit coupled to the memory; and a decoder coupled to the processorfunctional unit and configured to: receive an instruction that specifiesa set of indices and the destination register; based on the instruction,cause the processor functional unit to: read a set of table elementsfrom the set of tables by, for each table of the set of tables, readinga respective subset of the set of table elements based on a respectiveindex of the set of indices; and store the set of table elements in theintermediate register in a first order; based on the instruction, causethe butterfly network to: reorder the set of table elements to be in asecond order; and store the set of table elements in the destinationregister in the second order.
 2. The device of claim 1, wherein: thememory includes a set of banks; and the first order is based on anarrangement of the set of table elements among the set of banks of thememory.
 3. The device of claim 1, wherein: the set of tables includes aset of columns; and the first order is based on an arrangement of theset of table elements among the set of columns.
 4. The device of claim1, wherein the memory is a level one (L1) cache.
 5. The device of claim1, wherein: the instruction further specifies a number of table elementsto read in addition to an indexed table element; and the processorfunctional unit is configured to: read a first table element from theset of tables based on the set of indices; and determine whether to reada second table element from the set of tables based on the number oftable elements to read in addition to an indexed table element.
 6. Thedevice of claim 1, wherein the instruction further specifies whether toperform extension on the set of table elements prior to storing in thedestination register.
 7. The device of claim 1, wherein the instructionspecifies the set of indices by specifying a vector source indexregister that stores the set of indices.
 8. The device of claim 1further comprising a base address register configured to store a baseaddress of the set of tables, wherein the instruction specifies the setof tables by specifying the base address register.
 9. The device ofclaim 1 further comprising a configuration register configured to storea configuration of the set of tables, wherein the instruction specifiesthe configuration register.
 10. The device of claim 9, wherein theconfiguration specifies a size of each of the set of data elements. 11.The device of claim 9, wherein the configuration specifies a size ofeach table of the set of tables.
 12. The device of claim 9, wherein theconfiguration specifies a number of tables in the set of tables.
 13. Aprocessor comprising: a level one (L1) cache that includes a firstportion configured as a data cache and a second portion configured to bedirectly accessible, wherein the second portion is configured to store aset of tables; an intermediate register coupled to the L1 cache; abutterfly network coupled to the intermediate register; a destinationregister coupled to the L1 cache; and a functional unit coupled to theL1 cache and configured to, based on an instruction: read a set of tableelements from the set of tables based on a set of indices; store the setof table elements in the intermediate register in a first order; causethe butterfly network to reorder the set of table elements to be in asecond order; and store the set of table elements in the destinationregister in the second order.
 14. The processor of claim 13, wherein:the L1 cache includes a set of banks; and the first order is based on anarrangement of the set of table elements among the set of banks of theL1 cache.
 15. The processor of claim 13, wherein: the set of tablesincludes a set of columns; and the first order is based on anarrangement of the set of table elements among the set of columns.
 16. Amethod comprising: storing a set of tables in a memory; receiving aninstruction that specifies a set of indices and a destination register;and based on the instruction: reading a set of table elements from theset of tables based on the set of indices; storing the set of tableelements in an intermediate register in a first order; reordering theset of table elements to be in a second order; and storing the set oftable elements in the destination register in the second order.
 17. Themethod of claim 16, wherein: the memory includes a set of banks; and thefirst order is based on an arrangement of the set of table elementsamong the set of banks of the memory.
 18. The method of claim 16,wherein: the set of tables includes a set of columns; and the firstorder is based on an arrangement of the set of table elements among theset of columns.
 19. The method of claim 16, wherein the memory is alevel one (L1) cache.
 20. The method of claim 16, wherein: theinstruction further specifies a number of table elements to read inaddition to an indexed table element; and the method further comprises:reading a first table element from the set of tables based on the set ofindices; and determining whether to read a second table element from theset of tables based on the number of table elements to read in additionto an indexed table element.